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