twilio-sync
Advanced tools
Comparing version 0.4.2-dev.5 to 0.4.2-dev.6
@@ -748,36 +748,18 @@ "use strict"; | ||
value: function forEach(handler) { | ||
return new _promise2.default(function (reject) { | ||
/* | ||
if (this._cacheState.ensured) { | ||
this.items.forEach(handler); | ||
resolve(); | ||
} else { | ||
let firstPageQueryArgs = { | ||
order: 'asc', | ||
limit: 50 | ||
}; | ||
let getFirstPage = () => this._query(firstPageQueryArgs); | ||
let handleEnd = () => { | ||
this._cacheState.ensured = true; | ||
resolve(); | ||
}; | ||
this._processPage(getFirstPage, handler, handleEnd).catch(reject); | ||
var _this5 = this; | ||
return new _promise2.default(function (resolve, reject) { | ||
function processPage(page) { | ||
page.items.forEach(function (x) { | ||
return handler(x); | ||
}); | ||
if (page.hasNextPage) { | ||
page.nextPage().then(processPage); | ||
} else { | ||
resolve(); | ||
} | ||
} | ||
*/ | ||
reject(new Error('Not implemented')); | ||
_this5.queryItems().then(processPage); | ||
}); | ||
} | ||
/* | ||
private _processPage(getPage :any, handleElement :any, handleEnd :any) : Promise<Paginator<Item>> { | ||
return getPage().then(page => { | ||
page.items.forEach(el => handleElement(el)); | ||
if (page.hasNextPage) { | ||
setTimeout(() => this._processPage(page.nextPage.bind(page), handleElement, handleEnd)); | ||
} else { | ||
handleEnd(); | ||
} | ||
}); | ||
} | ||
*/ | ||
}, { | ||
@@ -784,0 +766,0 @@ key: "shouldIgnoreEvent", |
@@ -119,3 +119,3 @@ import { SyncEntity, EntityServices } from './entity'; | ||
*/ | ||
protected queryItems(args: any): Promise<Paginator<Item>>; | ||
protected queryItems(args?: any): Promise<Paginator<Item>>; | ||
/** | ||
@@ -130,3 +130,3 @@ * Get a list of items from the Map | ||
*/ | ||
getItems(args: any): Promise<Paginator<Item>>; | ||
getItems(args?: any): Promise<Paginator<Item>>; | ||
/** | ||
@@ -133,0 +133,0 @@ * Synchronizes object with state on a server |
@@ -342,35 +342,15 @@ "use strict"; | ||
forEach(handler) { | ||
return new Promise((reject) => { | ||
/* | ||
if (this._cacheState.ensured) { | ||
this.items.forEach(handler); | ||
resolve(); | ||
} else { | ||
let firstPageQueryArgs = { | ||
order: 'asc', | ||
limit: 50 | ||
}; | ||
let getFirstPage = () => this._query(firstPageQueryArgs); | ||
let handleEnd = () => { | ||
this._cacheState.ensured = true; | ||
resolve(); | ||
}; | ||
this._processPage(getFirstPage, handler, handleEnd).catch(reject); | ||
return new Promise((resolve, reject) => { | ||
function processPage(page) { | ||
page.items.forEach(x => handler(x)); | ||
if (page.hasNextPage) { | ||
page.nextPage().then(processPage); | ||
} | ||
else { | ||
resolve(); | ||
} | ||
} | ||
*/ | ||
reject(new Error('Not implemented')); | ||
this.queryItems().then(processPage); | ||
}); | ||
} | ||
/* | ||
private _processPage(getPage :any, handleElement :any, handleEnd :any) : Promise<Paginator<Item>> { | ||
return getPage().then(page => { | ||
page.items.forEach(el => handleElement(el)); | ||
if (page.hasNextPage) { | ||
setTimeout(() => this._processPage(page.nextPage.bind(page), handleElement, handleEnd)); | ||
} else { | ||
handleEnd(); | ||
} | ||
}); | ||
} | ||
*/ | ||
shouldIgnoreEvent(key, eventId) { | ||
@@ -377,0 +357,0 @@ return this.cache.isKnown(key, eventId); |
{ | ||
"name": "twilio-sync", | ||
"version": "0.4.2-dev.5", | ||
"version": "0.4.2-dev.6", | ||
"description": "Twilio Sync client library", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1998844
29321