Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
run: function(modules, callback) {
var id = this.counter++;
this.worker.postMessage({
id: id,
modules: (typeof modules === 'string' ? [modules] : modules) || [],
callback: String(callback),
});
var dfd = new Promise.Deferred();
this.deferreds[id] = dfd;
dfd.promise.test = this._wrapTest.bind(this, dfd.promise);
return dfd.promise;
},
};
return function delay(duration) {
var dfd = new Promise.Deferred();
setTimeout(dfd.resolve, duration);
return dfd.promise;
};
});
initialize: function(parent) {
var dfd = new Promise.Deferred();
this.element = document.createElement('iframe');
parent.appendChild(this.element);
this.window = this.element.contentWindow;
this.document = this.window.document;
this.document.open();
this.document.write(this.source);
this.document.close();
if (!this.window) {
dfd.reject();
return dfd.promise;
}
var resolve = function() {