Adds Promise to the getOperatorList

This commit is contained in:
Yury Delendik 2014-05-09 20:21:15 -05:00
parent 37a6aac972
commit d8eb8b1de1
6 changed files with 568 additions and 488 deletions

View file

@ -507,11 +507,17 @@ var Catalog = (function CatalogClosure() {
},
cleanup: function Catalog_cleanup() {
this.fontCache.forEach(function (font) {
delete font.sent;
delete font.translated;
var promises = [];
this.fontCache.forEach(function (promise) {
promises.push(promise);
});
this.fontCache.clear();
return Promise.all(promises).then(function (fonts) {
for (var i = 0, ii = fonts.length; i < ii; i++) {
delete fonts[i].sent;
delete fonts[i].translated;
}
this.fontCache.clear();
}.bind(this));
},
getPage: function Catalog_getPage(pageIndex) {