mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-16 12:45:16 +08:00
45 lines
736 B
JavaScript
45 lines
736 B
JavaScript
|
|
var
|
|
_ = require('_'),
|
|
Promise = require('Promise'),
|
|
|
|
Utils = require('Common/Utils');
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
function AbstractBasicPromises()
|
|
{
|
|
this.oPromisesStack = {};
|
|
}
|
|
|
|
AbstractBasicPromises.prototype.func = function(fFunc)
|
|
{
|
|
fFunc();
|
|
return this;
|
|
};
|
|
|
|
AbstractBasicPromises.prototype.fastResolve = function(mData)
|
|
{
|
|
return Promise.resolve(mData);
|
|
};
|
|
|
|
AbstractBasicPromises.prototype.fastReject = function(mData)
|
|
{
|
|
return Promise.reject(mData);
|
|
};
|
|
|
|
AbstractBasicPromises.prototype.setTrigger = function(mTrigger, bValue)
|
|
{
|
|
if (mTrigger)
|
|
{
|
|
_.each(Utils.isArray(mTrigger) ? mTrigger : [mTrigger], function(fTrigger) {
|
|
if (fTrigger)
|
|
{
|
|
fTrigger(!!bValue);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
module.exports = AbstractBasicPromises;
|