@@ -21,13 +21,7 @@ module.exports = function (subject, options) {
2121 return subject ;
2222 } ) ( ) ;
2323
24- var withOps = globalItems . reduce ( function ( subject , item ) {
25- var value = options . get ( item . option ) ;
26- if ( value > 0 ) {
27- return subject [ item . fnName ] . call ( subject , value , scheduler ) ;
28- }
29- return subject ;
30- } , initial ) ;
24+ var withOps = applyOperators ( globalItems , initial , options , scheduler ) ;
3125
3226 return withOps
3327 . map ( function ( xs ) {
@@ -48,6 +42,38 @@ module.exports = function (subject, options) {
4842 } ) ;
4943} ;
5044
45+ function applyReloadOperators ( subject , options ) {
46+ var globalItems = [
47+ {
48+ option : "reloadDebounce" ,
49+ fnName : "debounce"
50+ } ,
51+ {
52+ option : "reloadThrottle" ,
53+ fnName : "throttle"
54+ } ,
55+ {
56+ option : "reloadDelay" ,
57+ fnName : "delay"
58+ }
59+ ] ;
60+
61+ var scheduler = options . getIn ( [ "debug" , "scheduler" ] ) ;
62+
63+ return applyOperators ( globalItems , subject , options , scheduler ) ;
64+ }
65+ module . exports . applyReloadOperators = applyReloadOperators ;
66+
67+ function applyOperators ( items , subject , options , scheduler ) {
68+ return items . reduce ( function ( subject , item ) {
69+ var value = options . get ( item . option ) ;
70+ if ( value > 0 ) {
71+ return subject [ item . fnName ] . call ( subject , value , scheduler ) ;
72+ }
73+ return subject ;
74+ } , subject ) ;
75+ }
76+
5177function getDebouncedStream ( subject , options , scheduler ) {
5278 return subject
5379 . filter ( function ( x ) { return options . get ( "watchEvents" ) . indexOf ( x . event ) > - 1 } )
0 commit comments