embark-area-51/lib/modules/code_generator/code_templates/load-manager.js.ejs

5 lines
489 B
Plaintext

__mainContext.__LoadManager = function() { this.list = []; this.done = false; this.err = null; }
__mainContext.__LoadManager.prototype.execWhenReady = function(cb) { if (this.done) { cb(this.err); } else { this.list.push(cb) } }
__mainContext.__LoadManager.prototype.doFirst = function(todo) { var self = this; todo(function(err) { self.done = true; self.err = err; self.list.map((x) => x.apply(x, [self.err])) }) }
__mainContext.__loadManagerInstance = new __mainContext.__LoadManager();