Removes event listeners registered via ctx.on(eventName, handler). It is often used in conjunction with ctx.on to unsubscribe at the appropriate time, preventing memory leaks or duplicate triggers.
| Scenario | Description |
|---|---|
| React useEffect Cleanup | Called within the useEffect cleanup function to remove listeners when the component unmounts. |
| JSField / JSEditableField | Unsubscribe from js-field:value-change during two-way data binding for fields. |
| Resource Related | Unsubscribe from listeners like refresh or saved registered via ctx.resource.on. |
handler passed to ctx.off must be the same reference as the one used in ctx.on; otherwise, it cannot be correctly removed.ctx.off before the component unmounts or the context is destroyed to avoid memory leaks.on/off methods