Skip to content

Commit

Permalink
feat(task-queue): sync with latest from current
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jun 18, 2018
1 parent 089ccb1 commit bf242a7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/runtime/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,17 @@ export const PLATFORM = {
},

createMicroTaskFlushRequestor(onFlush: () => void): () => void {
let toggle = 1;
const observer = new MutationObserver(onFlush);
const node = document.createTextNode('');

observer.observe(node, { characterData: true });
const values = Object.create(null);
let val = 'a';

values.a = 'b';
values.b = 'a';
observer.observe(node, { characterData: true });

return function requestFlush() {
toggle = -toggle;
node.data = toggle.toString();
node.data = val = values[val];
};
}
};

0 comments on commit bf242a7

Please sign in to comment.