Created
March 25, 2015 11:44
-
-
Save teebot/3918797e1c8133306914 to your computer and use it in GitHub Desktop.
Custom Event JS
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
var event = new CustomEvent('newMsg', { detail: 'Hello people' }); | |
window.addEventListener('newMsg', function handler(e){ console.log(e.detail) }, false); | |
window.dispatchEvent(event); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment