gf.triggerEngineEvent
gf.triggerEngineEvent(eventName: string, data: Object): Promise<void>
Section titled “gf.triggerEngineEvent(eventName: string, data: Object): Promise<void>”Simulates the dispatch of a custom event from the engine with a specified name and associated data.
eventName
: The name of the custom event to trigger.data
: The payload to include in the event.- Returns a promise that resolves once the event has been successfully triggered.
describe('Test script', function () { it('Test 1', async () => { // For demonstration purposes, we subscribe to the 'custom-event' from the engine here. In practice, this should be handled within the UI. await gf.executeBindingScript(() => { engine.on('custom-event', (data) => { document.querySelector('#custom-engine-event').textContent = data.value; }); }); await gf.triggerEngineEvent('custom-event', { value: 1 }); });});