counterpart of "Bangle.on('accel',...)"?

Posted on
  • Hello!

    Besides the pure "fun" experiments published before, I'm also preparing some "professional" experiments to be run as soon as I will get my developer preview of Bangle.js

    This is why the following question came up: I know that I can install an event handler for the Accelerometer using


    But, how do I deinstall that handler again?

  • ..I assume passing undefined for the function does the job... --- and if not, then just provide an 'empty' / nop function: function(){} ... ()=> (latter I'm not sure about).

  • I assume passing undefined for the function does the job...

    That'll just add another handler...

    You'll need Bangle.removeAllListeners('accel') :­ct_removeAllListeners

  • @allObjects passing null for the function produces

    Uncaught TypeError: Second argument to EventEmitter.on(..) must be a function or a String (containing code)

    And I do not want to provide a dummy function, since removing an event handler may (now or later) be used for internal optimization (as no handler has to be called if none has been provided)

    @Gordon great, thank you! Is there also a possibility to uninstall a specific handler only?

  • ...ddddoohh (to myself)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

counterpart of "Bangle.on('accel',...)"?

Posted by Avatar for Andreas_Rozek @Andreas_Rozek