Trigger event on shake stops ?
Tisseur2Toile opened this issue · comments
Hello,
Maybe it is a stupid question, but is there a simple mean to know when shake stops ?
It would really help in my current project.
Could your project not just poll for shake events and then fire a callback when one does not occur after x seconds?
That's what I was trying to do but I'm a little puzzled to find a correct way to do it...
I found a way like this and it's working, but maybe it is not a very clean way, any thoughts ?
var testInt = false;
function shakeEventDidOccur () {
if (testInt !== false)
{
clearInterval(testInt);
}
testInt = setInterval(clearMyInt, 1200);
console.log('shaking');
}
function clearMyInt() {
clearInterval(testInt);
alert('done');
}
Something like that should work - sorry I don't have much time to offer assistance with code that's not specific to the library itself.
@alexgibson ok, I understand, thanks for your time and great library btw ! ;)
No problem, good luck - and thanks 👍