Sha256: f0c88784d776b5cb886a7e43d6bdb3326a83ad19e8fded1b5cd4f4d77a704714

Contents?: true

Size: 938 Bytes

Versions: 25

Compression:

Stored size: 938 Bytes

Contents

"use strict";
module.exports = function(Promise, CapturedTrace, isDebugging) {
var contextStack = [];
function Context() {
    this._trace = new CapturedTrace(peekContext());
}
Context.prototype._pushContext = function () {
    if (!isDebugging()) return;
    if (this._trace !== undefined) {
        contextStack.push(this._trace);
    }
};

Context.prototype._popContext = function () {
    if (!isDebugging()) return;
    if (this._trace !== undefined) {
        contextStack.pop();
    }
};

function createContext() {
    if (isDebugging()) return new Context();
}

function peekContext() {
    var lastIndex = contextStack.length - 1;
    if (lastIndex >= 0) {
        return contextStack[lastIndex];
    }
    return undefined;
}

Promise.prototype._peekContext = peekContext;
Promise.prototype._pushContext = Context.prototype._pushContext;
Promise.prototype._popContext = Context.prototype._popContext;

return createContext;
};

Version data entries

25 entries across 19 versions & 6 rubygems

Version Path
ilog-0.4.1 node_modules/bluebird/js/main/context.js
ilog-0.4.0 node_modules/bluebird/js/main/context.js
ilog-0.3.3 node_modules/bluebird/js/main/context.js
proxy_chain_rb-0.1.2 lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js
proxy_chain_rb-0.1.0 lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js
browsed-0.3.1 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js
browsed-0.3.0 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js
browsed-0.2.9 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js
browsed-0.2.8 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js
browsed-0.2.7 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js
browsed-0.2.6 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/bluebird/js/main/context.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/bluebird/js/main/context.js
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/context.js
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/bluebird/js/main/context.js
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/bluebird/js/main/context.js
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/context.js
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/bluebird/js/main/context.js
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/context.js
gulp_assets-1.0.0.pre.5 template/node_modules/babel-core/node_modules/bluebird/js/main/context.js