snappymail/dev/Promises/AbstractBasic.js
RainLoop Team 8da988fef2 Synchronize localizations from Transifex
Update package.json dependencies
Fix eslint errors
webpack 2 -> webpack 3
2017-06-24 22:26:27 +03:00

34 lines
509 B
JavaScript

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