Last active
April 12, 2019 20:46
-
-
Save rgruesbeck/174d29f244494ead21e2621f6f0d79ee to your computer and use it in GitHub Desktop.
koji live preview injection
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
// listen for post message | |
// you will need to attach the listener to window instead of document for this to work | |
window.addEventListener("message", injectHandler, false); | |
// handle the update | |
function injectHandler({ data }) { | |
if (data.action === 'injectGlobal') { | |
let { scope, key, value } = data.payload; | |
config[scope][key] = value; | |
load(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment