snappymail/dev/Promises/AbstractBasic.js
RainLoop Team ae996b75f1 Updated: dependencies
+ small fixes
2016-10-18 21:28:42 +03:00

34 lines
497 B
JavaScript

import Promise from 'Promise';
import {isArray} from 'Common/Utils';
export class AbstractBasicPromises
{
oPromisesStack = {};
func(fFunc) {
fFunc();
return this;
}
fastResolve(mData) {
return Promise.resolve(mData);
}
fastReject(mData) {
return Promise.reject(mData);
}
setTrigger(trigger, value) {
if (trigger)
{
value = !!value;
(isArray(trigger) ? trigger : [trigger]).forEach((fTrigger) => {
if (fTrigger)
{
fTrigger(value);
}
});
}
}
}