Unsubscribe an event using javascript

  • 1
  • Question
  • Updated 4 months ago
  • Answered
How would I unsubscribe to an skuid event from javascript. Any help would be much appreciated.

Thanks.
Photo of Gyan

Gyan

  • 1,400 Points 1k badge 2x thumb

Posted 4 months ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,014 Points 20k badge 2x thumb
Looks like the docs on the skuid.events.unsubscribe() method are incomplete --- we'll get that fixed.

Every call to skuid.events.subscribe() returns a subscription/handle which can be used to unsubscribe in the future, e.g.

var subscription = skuid.events.subscribe("models.loaded", function() { ... });
skuid.events.unsubscribe(subscription);
Photo of Gyan

Gyan

  • 1,400 Points 1k badge 2x thumb
Thanks Zach! This isĀ  helpful.