Created
November 16, 2017 23:02
-
-
Save mrdoob/df80494a8cc53ddf8e8604a374936c31 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
function JSONParseAsync( text, callback ) { | |
var code = 'onmessage = function ( e ) { postMessage( JSON.parse( e.data ) ); close(); }'; | |
var blob = new Blob( [ code ], { type: 'text/plain' } ); | |
var worker = new Worker( window.URL.createObjectURL( blob ) ); | |
worker.addEventListener( 'message', function ( e ) { callback( e.data ); } ); | |
worker.postMessage( text ); | |
} |
Author
mrdoob
commented
Nov 16, 2017
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment