Giter Club home page Giter Club logo

gm-button-events's Introduction

gm-button-events

Button event dispatcher for GM's NGI JavaScript platform

Adds DOM style events for radio interface buttons.

document.addEventListener('buttonpress', function (e) {
  if (e.detail === 'BTN_BACK') {
    console.log('back button on dash was pressed!');
  }
}, false);

Should also play nicely with jQuery

$(document).on('buttonpress', function (e) {
  var btnName = e.originalEvent.detail;
  
  if (btnName === 'BTN_BACK') {
    console.log('back button on dash was pressed!');
  }
});

To see available buttons please refer to gm.info.watchButtons

License

MIT license

gm-button-events's People

Contributors

callmehiphop avatar

Watchers

 avatar  avatar  avatar

gm-button-events's Issues

tests!

because that would be nice

programmatic api?

it might be nice to expose some methods for starting/stopping the button watcher. my main concern would be hitting some sort of race condition where the script gets imported and watchButtons fails to start for some unknown reason.

this should be done before issue #2

change button event names?

Right now they're pretty generic and say stuff like "buttonpress", "buttonup", etc. Maybe we should make them more distinguishable to the radio and call them something like "gm-button-press".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.