Skip to content

Instantly share code, notes, and snippets.

@teaplanet
Created December 30, 2014 11:29
Show Gist options
  • Select an option

  • Save teaplanet/c92dd9bac06ddfdee2cf to your computer and use it in GitHub Desktop.

Select an option

Save teaplanet/c92dd9bac06ddfdee2cf to your computer and use it in GitHub Desktop.
Ractive.js Tutorial 4-2
<!-- http://learn.ractivejs.org/event-proxies/2/ -->
<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>
</script>
var ractive = new Ractive({
el: 'container',
template: '#template'
});
ractive.on({
activate: function(e){
alert('Activating!');
},
deactivate: function(e){
alert('Deactivate!');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment