Find more Ractive.js plugins at ractivejs.org
Listen for specific keypresses -
downarrow - on DOM elements.
Install from npm...
npm install ractive-events-keys
...or download it and add it as a script tag to your page:
<!-- must go first! -->
Use as a module...
Note: previous versions of this plugin would 'self-register'. If you are using a module system such as Browserify, Webpack or RequireJS, that's no longer the case - you must explicitly register the plugin.
var Ractive = ;var keys = ;// To use the plugin with a specific instancevar ractive =el: 'body'template: myTemplateevents:// just include the ones you needescape: keysescapescape: keysspace;// To use it with componentsMyComponent = Ractive;// To make handlers globally available to *all* instancesRactiveeventsspace = keysspace;Ractiveeventsescape = keysescape;
;;var ractive =el: 'body'template: myTemplateevents: escape space;
Use as a
If you include ractive-events-keys as a script tag, it will 'self-register' with the global
Ractive object, and all Ractive instances will be able to use its handlers.