Created
March 6, 2018 19:09
-
-
Save souenzzo/d3d305725355bb1ab18c69354380a0e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var atom = {val: 0} | |
timeout = 1 | |
const f = () => { | |
let state = atom.val | |
let dummmy = 0 | |
for (let i = 0; i < 10000; i++) { | |
// some computation of new state | |
dummy = i | |
} | |
// assign back | |
atom.val = state + 1 | |
} | |
setTimeout(f, timeout) | |
setTimeout(f, timeout) | |
setTimeout(f, timeout) | |
setTimeout(f, timeout) | |
setTimeout(f, timeout) | |
setTimeout(f, timeout) | |
setTimeout(f, timeout) | |
setTimeout(f, timeout) | |
setTimeout(f, timeout) | |
setTimeout(f, timeout) | |
setTimeout(() => console.log(atom), timeout + 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment