Created
December 30, 2014 11:37
-
-
Save teaplanet/675b85f12d2d1df1b9ff to your computer and use it in GitHub Desktop.
Ractive.js Tutorial 4-3
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
| <!-- http://learn.ractivejs.org/event-proxies/3/ --> | |
| <script src='http://cdn.ractivejs.org/latest/ractive.min.js'></script> | |
| <div id='container'></div> | |
| <script id='template' type='text/ractive'> | |
| <button on-click='activate'>Activate!</button> | |
| <button on-click='deactivate'>Deactivate!</button> | |
| <button on-click='silence'>Silence!</button> | |
| </script> |
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
| var ractive = new Ractive({ | |
| el: 'container', | |
| template: '#template' | |
| }); | |
| listener = ractive.on({ | |
| activate: function(e){ | |
| alert('Activating!'); | |
| }, | |
| deactivate: function(e){ | |
| alert('Deactivate!'); | |
| }, | |
| silence: function(e){ | |
| alert('No more alerts!'); | |
| listener.cancel(); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment