Created
June 24, 2016 21:47
-
-
Save andersevenrud/a5296a51fb55540375e0f88a3a34784c to your computer and use it in GitHub Desktop.
OS.js Iframe Application bi-directional API script (Application Example)
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
// If you send `message` it gets caught by the custom defined event | |
this.postMessage({message: 'something', bar: 'baz'}); | |
// But not this. It will get caught by the global one | |
this.postMessage({zazz: 'jazz'}); | |
// To check messages from iframe | |
ApplicationFooBar.prototype.onPostMessage = function(message, ev) { | |
console.warn(message.cool); // === "Awesome" | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment