mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-05 06:22:52 +08:00
30 lines
504 B
JavaScript
30 lines
504 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);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|