Skip to content

Commit

Permalink
fix: improve micro task helper
Browse files Browse the repository at this point in the history
(cherry picked from commit 76e2ab9)
  • Loading branch information
DylanPiercey committed Apr 15, 2020
1 parent 16beb60 commit 2129451
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 34 deletions.
32 changes: 0 additions & 32 deletions packages/marko/src/runtime/nextTick-browser.js

This file was deleted.

16 changes: 15 additions & 1 deletion packages/marko/src/runtime/nextTick.js
@@ -1 +1,15 @@
module.exports = process.nextTick;
var promise;
module.exports =
typeof queueMicrotask === "function"
? queueMicrotask
: typeof Promise === "function" && (promise = Promise.resolve())
? function(cb) {
promise.then(cb).catch(rethrow);
}
: setTimeout;

function rethrow(err) {
setTimeout(function() {
throw err;
});
}
1 change: 0 additions & 1 deletion packages/marko/src/runtime/package.json
@@ -1,6 +1,5 @@
{
"browser": {
"./nextTick": "./nextTick-browser.js",
"./index.js": "./index-browser.js"
}
}

0 comments on commit 2129451

Please sign in to comment.