Last active
July 1, 2021 13:42
-
-
Save nuxodin/e1a052ac4d351fa82dce9f9e7071bba1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
writeStack = []; | |
write = function(callback){ | |
if (!writeStack.length) requestAnimationFrame(handleWriteStack); | |
writeStack.push(callback); | |
} | |
handleWriteStack = function(){ | |
while (writeStack.length) writeStack.pop()(); | |
} | |
readStack = []; | |
read = function(callback){ | |
//if (!readStack.length) requestPostAnimationFrame(handleReadStack); | |
if (!readStack.length) setTimeout(handleReadStack); | |
readStack.push(callback); | |
} | |
handleReadStack = function(){ | |
while (readStack.length) readStack.pop()(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment