updated by GasGit automation
This commit is contained in:
parent
cc41afccff
commit
4dcfa8ab51
1 changed files with 12 additions and 6 deletions
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
var ClientWatcher = (function (ns) {
|
||||
|
||||
var watchers_ = {},startTime_=0;;
|
||||
var watchers_ = {},startTime_=0, pack_;
|
||||
|
||||
// now clean it
|
||||
function cleanTheCamel_ (cleanThis) {
|
||||
|
@ -35,7 +35,7 @@ var ClientWatcher = (function (ns) {
|
|||
|
||||
// default settings for a Watcher request
|
||||
var watch = Utils.vanMerge ([{
|
||||
pollFrequency:2500,
|
||||
pollFrequency:2500, // if this is 0, then polling is not done, and it needs self.poke()
|
||||
id: '' , // Watcher id
|
||||
watch: {
|
||||
active: true, // whether to watch for changes to active
|
||||
|
@ -190,6 +190,9 @@ var ClientWatcher = (function (ns) {
|
|||
|
||||
}
|
||||
|
||||
self.getPack = function () {
|
||||
return pack_;
|
||||
};
|
||||
|
||||
// convenience function to endlessly poll and callback on any changes
|
||||
self.watch = function (callback) {
|
||||
|
@ -199,6 +202,7 @@ var ClientWatcher = (function (ns) {
|
|||
self.start()
|
||||
.then (function(pack) {
|
||||
|
||||
|
||||
if (pack.changed.active || pack.changed.data || pack.changed.sheets) {
|
||||
callback(current_, pack, self);
|
||||
}
|
||||
|
@ -210,7 +214,7 @@ var ClientWatcher = (function (ns) {
|
|||
})
|
||||
['catch'](function(err) {
|
||||
// this will have been dealt with further up, but we still need to repoll
|
||||
if (!stopped_) {
|
||||
if (!stopped_ && watch_.pollFrequency) {
|
||||
self.watch(callback);
|
||||
}
|
||||
});
|
||||
|
@ -251,6 +255,9 @@ var ClientWatcher = (function (ns) {
|
|||
.then (
|
||||
function (pack) {
|
||||
|
||||
// save this for interest
|
||||
pack_ = pack;
|
||||
|
||||
// if there's been some changes to data then store it
|
||||
if (pack.data) {
|
||||
|
||||
|
@ -302,4 +309,3 @@ var ClientWatcher = (function (ns) {
|
|||
|
||||
return ns;
|
||||
})(ClientWatcher || {});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue