Skip to main content

Subscribe to events

The Event class allows you to register and unregister callbacks that are triggered when specific events occur in your Lens.

Methods​

add(function(T eventArgs) callback) : EventRegistration​

Adds the callback to the event.


remove(EventRegistration registration) : void​

Removes the registered callback from the event.


Examples​

//@input Component.InteractionComponent interactionComponent

// Subscribe to the onTap event
var onTapEvent = script.interactionComponent.onTap.add(function (tapEventArgs) {
print('onTap!');
});

// Unsubscribe from the onTap event
script.interactionComponent.onTap.remove(onTapEvent);
Was this page helpful?
Yes
No