Skip to content

Instantly share code, notes, and snippets.

@dcneiner
Last active December 11, 2015 02:48
Show Gist options
  • Save dcneiner/4532957 to your computer and use it in GitHub Desktop.
Save dcneiner/4532957 to your computer and use it in GitHub Desktop.
var shouldSerialize = (function () {
var serialize = false;
window.addEventListener( "message", function callback ( e ) {
serialize = e.data.sample === true;
window.removeEventListener( "message", callback );
}, false);
window.postMessage( { sample: true }, "*" );
return serialize;
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment