Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
PromiseMock.install = function install() {
PromiseMock._original = root.Promise;
PromiseMock._originalImmediate = Promise._immediateFn;
// Update the immediate function to push to queue
Promise._immediateFn = function mockImmediateFn(fn) {
PromiseMock.waiting.push(fn);
};
root.Promise = PromiseMock;
};
PromiseMock.install = function install() {
PromiseMock._original = root.Promise;
PromiseMock._originalImmediate = Promise._immediateFn;
// Update the immediate function to push to queue
Promise._immediateFn = function mockImmediateFn(fn) {
PromiseMock.waiting.push(fn);
};
root.Promise = PromiseMock;
};
(function (root) {
root.self = root;
root.global = root;
// So that promise-polyfill does not crash.
root.setTimeout = null;
// Sets Promise on root.
var Promise = require('promise-polyfill');
delete root.setTimeout;
Promise._immediateFn = _dukEnclaveNative.nextTick;
root.nextTick = _dukEnclaveNative.nextTick;
root.setImmediate = _dukEnclaveNative.nextTick;
root.Promise = Promise;
root.console = {
log: function () {
_dukEnclaveNative.debug(Array.prototype.join.call(arguments, ' '));
},
warn: function () {
_dukEnclaveNative.debug(Array.prototype.join.call(arguments, ' '));
},
error: function () {