addEventListener

You can subscribe to any of the ApiEvents, by adding a callback function that will execute whenever the subscribed event triggers.

addEventListener(
		eventName: ApiEvents, 
		callback: (result: EventResponses) => void
): Promise<void>
Parameters
Description

eventName

ApiEvents Name of the event that the method will subscribe to.

callback

(result: EventResponses) => void Callback function which takes as parameter the result of the event you are subscribing to.

Usage:

modelApi.addEventListener(
		"configurator_state_change",
		(res) => {
		    // Your code here
		}
);

Example

Last updated