Trigger an event, either native or custom, and optionally pass data along.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts | Object | The options object. Properties
|
- Since
- 1.0.0
- Source
Returns:
- Type:
- void
Example
import { trigger } from "@gravityforms/utils";
function Example() {
trigger( { event: 'gform/flyout/open', native: false, data: {
something: 'we need',
} } );
};
// elsewhere in the codebase
document.addEventListener( 'gform/flyout/open', function( event ) {
console.log( event.detail.something );
} );
Requires
- module:assign