2017-10-22 00:03:26 -05:00
|
|
|
declare var global: NodeJS.Global;
|
|
|
|
|
2019-06-19 12:59:03 -05:00
|
|
|
(global as any).requestAnimationFrame = (callback: any) => {
|
2017-10-22 00:03:26 -05:00
|
|
|
setTimeout(callback, 0);
|
|
|
|
};
|
|
|
|
|
2019-06-19 12:59:03 -05:00
|
|
|
(Promise.prototype as any).finally = function(onFinally: any) {
|
2018-07-11 13:23:07 -05:00
|
|
|
return this.then(
|
|
|
|
/* onFulfilled */
|
2019-06-19 12:59:03 -05:00
|
|
|
(res: any) => Promise.resolve(onFinally()).then(() => res),
|
2018-07-11 13:23:07 -05:00
|
|
|
/* onRejected */
|
2019-06-19 12:59:03 -05:00
|
|
|
(err: any) =>
|
2018-07-11 13:23:07 -05:00
|
|
|
Promise.resolve(onFinally()).then(() => {
|
|
|
|
throw err;
|
|
|
|
})
|
|
|
|
);
|
|
|
|
};
|