Skip to content

Instantly share code, notes, and snippets.

@andersevenrud
Created June 24, 2016 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andersevenrud/a5296a51fb55540375e0f88a3a34784c to your computer and use it in GitHub Desktop.
Save andersevenrud/a5296a51fb55540375e0f88a3a34784c to your computer and use it in GitHub Desktop.
OS.js Iframe Application bi-directional API script (Application Example)
// 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