Using Throttle-Debounce with addEventListener

I'm using deviceorientation on a mobile site, but I don't want to capture every movement. I just want 1 per second, so I'm trying to use the throttle-debounce plugin.

My original working code looked like this...

  function (event) {
    tilt([event.alpha, event.beta, event.gamma]);

...but when I add the throttle like so...

   function (event){
     tilt([event.alpha, event.beta, event.gamma]);

... I get a...

Uncaught TypeError: Object function ( selector, context ) {
    // The jQuery object is actually just the init constructor 'enhanced'
    return new jQuery.fn.init( selector, context, rootjQuery );
} has no method 'throttle' 

I'm guessing I've gotten the syntax wrong, but I've tried a couple of variations and I can't quite get it. Help?

If anyone has a better way to do the same without a plugin that would be just as good :)



Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.