mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-25 15:17:57 +00:00
chore: update to version 14.0.11 and align website URLs
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @name nextTick
|
||||
* @description Defer the operation to the queue for evaluation on the next tick
|
||||
*/
|
||||
export function nextTick(onExec, onError) {
|
||||
// While Promise.resolve().then(...) would defer to the nextTick, this
|
||||
// actually does not play as nicely in browsers like the setTimeout(...)
|
||||
// approach. So the safer, though less optimal approach is the one taken here
|
||||
setTimeout(() => {
|
||||
Promise
|
||||
.resolve()
|
||||
.then(() => {
|
||||
onExec();
|
||||
})
|
||||
.catch((error) => {
|
||||
if (onError) {
|
||||
onError(error);
|
||||
}
|
||||
else {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user