File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export default class SmartApollo {
1010 this . initialOptions = options
1111 this . options = Object . assign ( { } , options )
1212 this . _skip = false
13+ this . _pollInterval = null
1314 this . _watchers = [ ]
1415 this . _destroyed = false
1516
@@ -29,6 +30,22 @@ export default class SmartApollo {
2930 } else {
3031 this . _skip = true
3132 }
33+
34+ if ( typeof this . options . pollInterval === 'function' ) {
35+ this . _pollWatcher = this . vm . $watch ( this . options . pollInterval . bind ( this . vm ) , this . pollIntervalChanged . bind ( this ) , { immediate :true } )
36+ }
37+ }
38+
39+ pollIntervalChanged ( value , oldValue ) {
40+ if ( value !== oldValue ) {
41+ this . pollInterval = value
42+
43+ if ( value == null ) {
44+ this . stopPolling ( )
45+ } else {
46+ this . startPolling ( value )
47+ }
48+ }
3249 }
3350
3451 skipChanged ( value , oldValue ) {
@@ -37,6 +54,14 @@ export default class SmartApollo {
3754 }
3855 }
3956
57+ get pollInterval ( ) {
58+ return this . _pollInterval
59+ }
60+
61+ set pollInterval ( value ) {
62+ this . _pollInterval = value
63+ }
64+
4065 get skip ( ) {
4166 return this . _skip
4267 }
You can’t perform that action at this time.
0 commit comments