{"action":"created","issue":{"url":"https://api.github.com/repos/intel-iot-devkit/mraa/issues/339","labels_url":"https://api.github.com/repos/intel-iot-devkit/mraa/issues/339/labels{/name}","comments_url":"https://api.github.com/repos/intel-iot-devkit/mraa/issues/339/comments","events_url":"https://api.github.com/repos/intel-iot-devkit/mraa/issues/339/events","html_url":"https://github.com/intel-iot-devkit/mraa/issues/339","id":113230611,"number":339,"title":"Working with JS callbacks","user":{"login":"mulderp","id":220560,"avatar_url":"https://avatars.githubusercontent.com/u/220560?v=3","gravatar_id":"","url":"https://api.github.com/users/mulderp","html_url":"https://github.com/mulderp","followers_url":"https://api.github.com/users/mulderp/followers","following_url":"https://api.github.com/users/mulderp/following{/other_user}","gists_url":"https://api.github.com/users/mulderp/gists{/gist_id}","starred_url":"https://api.github.com/users/mulderp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulderp/subscriptions","organizations_url":"https://api.github.com/users/mulderp/orgs","repos_url":"https://api.github.com/users/mulderp/repos","events_url":"https://api.github.com/users/mulderp/events{/privacy}","received_events_url":"https://api.github.com/users/mulderp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-25T14:58:56Z","updated_at":"2015-10-25T16:04:53Z","closed_at":null,"body":"Hi,\r\n\r\njust curious about why there are no callbacks used in the JavaScript examples.\r\nI am looking at using an input button: When it is pressed, a callback should be executed, e.g.:\r\n\r\n      var button = new mraa.Gpio(4);\r\n      button.dir(mraa.DIR_IN);\r\n\r\n      button.read(function(d) {\r\n          if (d==1) {\r\n            console.log('ON');\r\n          } else {\r\n            console.log('OFF');\r\n          }\r\n      }, sampleRate);\r\n\r\nWould something like this be possible?"},"comment":{"url":"https://api.github.com/repos/intel-iot-devkit/mraa/issues/comments/150937642","html_url":"https://github.com/intel-iot-devkit/mraa/issues/339#issuecomment-150937642","issue_url":"https://api.github.com/repos/intel-iot-devkit/mraa/issues/339","id":150937642,"user":{"login":"FlippieCoetser","id":3672126,"avatar_url":"https://avatars.githubusercontent.com/u/3672126?v=3","gravatar_id":"","url":"https://api.github.com/users/FlippieCoetser","html_url":"https://github.com/FlippieCoetser","followers_url":"https://api.github.com/users/FlippieCoetser/followers","following_url":"https://api.github.com/users/FlippieCoetser/following{/other_user}","gists_url":"https://api.github.com/users/FlippieCoetser/gists{/gist_id}","starred_url":"https://api.github.com/users/FlippieCoetser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FlippieCoetser/subscriptions","organizations_url":"https://api.github.com/users/FlippieCoetser/orgs","repos_url":"https://api.github.com/users/FlippieCoetser/repos","events_url":"https://api.github.com/users/FlippieCoetser/events{/privacy}","received_events_url":"https://api.github.com/users/FlippieCoetser/received_events","type":"User","site_admin":false},"created_at":"2015-10-25T16:04:53Z","updated_at":"2015-10-25T16:04:53Z","body":"Their is a function called ISR that you can use to configure the interrupt. Just watch out not all pins can be used with interrupts. Check the documents for more details on the ISR func."}}