Last active
August 29, 2015 14:06
-
-
Save webOS101/fdb3d75dec84cfbefb6b to your computer and use it in GitHub Desktop.
Event Sample
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
enyo.ready(function() { | |
enyo.kind({ | |
name: 'Eventer', | |
handlers: { ontap: 'myTap' }, | |
events: { onMyEvent: '' }, | |
content: 'Click for the answer', | |
myTap: function() { | |
this.doMyEvent({ answer: 42 }); | |
} | |
}); | |
enyo.kind({ | |
name: 'Subscriber', | |
components: [{ kind: 'Eventer', onMyEvent: 'answered' }], | |
answered: function(sender, event) { | |
alert('The answer is: ' + event.answer); | |
return(true); | |
} | |
}); | |
new enyo.Application({ name: 'app', view: 'Subscriber' }) | |
}); |
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
name: Event Sample | |
description: Sending and receiving events | |
authors: | |
- Roy Sutton | |
normalize_css: no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try it out on jsFiddle
From: Enyo: Up and Running by Roy Sutton