How does Accel.on work with Pebble js? I know that for Pebble C SDK, you unsubscribe to the accel service, but there doesn't seem to be anything like that for Pebble js. I have a boolean called shake; in a function, while shake is false, I have Vibe.vibrate('long') to make the watch vibrate
In my Accel.on anonymous function, I set 'shake' to true
How does Accel.on actually work? In the C sdk, it seems to continuously call the handler. Is it the same for Javascript? the lines of code in question is this:
while (!shake){
Vibe.vibrate('long');
startAccelCheck();
}
startAccelCheck changes shake to true when acceleration is over a certain point
It currently does not work; I'm wondering if it's possible to change the value of shake to true in Accel.On while the loop is ongoing
Accel.on is a way of listening to an "accelTap" no matter what window is being displayed. The alternative is:
where
windis the active window in the stack. If the second method is used, the watch will only trigger the event if the selected window is active; whereasAccel.onis global and will pick up every "tap" of the watch.The
startAccelCheckis not specifically required, if all it does is set a global boolean value to true. Another way of doing this would be to put the changing of that value to true insidefunction(e)of the Accel.on etc.E.G.
Is there a GitHub repo or somewhere I can find your code to better help you?
Sourced from the Pebble developer docs.
Hope this helps.