Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/cls-bluebird/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
/*
* cls-bluebird
* Function to shim `Promise.prototype.call`
*/
// Modules
var shimmer = require('shimmer');
// Exports
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Patch `call` method to run callbacks in current CLS context.
*
* @param {Function} Promise - Bluebird Promise constructor to patch
* @param {Object} ns - CLS namespace to bind callbacks to
* @returns {undefined}
*/
module.exports = function(Promise, ns) {
// Patch method
shimmer.wrap(Promise.prototype, 'call', function(callOriginal) {
return function() {
// Temporarily wrap `this._then` to bind the object method to current CLS context
// (`this.call()` will call `this._then()` synchronously)
var _thenOriginal = this._then,
ownProperty = hasOwnProperty.call(this, '_then');
this._then = function() {
// Unwrap `this._then`
if (ownProperty) {
this._then = _thenOriginal;
} else {
delete this._then;
}
// Bind function that will be called to call object method to CLS context
arguments[0] = ns.bind(arguments[0]);
// Run original `this._then` method
return _thenOriginal.apply(this, arguments);
};
// Call original `call` method
return callOriginal.apply(this, arguments);
};
});
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0043 ]-- |