English
onEvent(eventName, handler)
About 104 wordsLess than 1 minute
2025-09-22
Listens for events for internal plugin communication. Use it together with emitEvent.
Parameters
| Parameter | Description | Type |
|---|---|---|
| eventName | Event name | String |
| handler | Event handler function | Function |
Return Value
None
Code Example
export default function (context) {
return {
/** After the create/edit page has finished rendering */
renderEnd(){
// Listen to the formRenderEnd event
context.onEvent("formRenderEnd",opt=>{
console.log("context.onEvent formRenderEnd", opt);//opt={test:1}
})
// Send the formRenderEnd event
context.emitEvent("formRenderEnd", {test:1});
}
}
}Notes
- It can only listen to events sent by the
emitEventmethod of thecontextobject within the lifecycle of the current create/edit page.
