notify — Dispatch a handle-object event to registered callbacks.
notify(target,event_name) calls enabled listeners for a live handle object. An event-data value, or RunMat's broader callback-argument list, is forwarded without numeric conversion. The current runtime returns double zero on success when a result is requested.
Syntax
status = notify(target, event_name, varargin)
notify(target, event_name, varargin)Inputs
target- Type
Any- Required
- Yes
- Description
- Live handle-object event source.
event_name- Type
StringScalar- Required
- Yes
- Description
- Case-sensitive event name.
varargin- Type
Any- Required
- Variadic
- Description
- Event-data object or RunMat callback arguments forwarded unchanged.
Returns
status- Type
Any- Description
- RunMat zero status on successful dispatch.
Errors
RunMat:NotifyTargetInvalid- When
- Target is not a live handle object.
- Message
notify: target must be a valid handle object
RunMat:NotifyInvalidCallback- When
- A registered callback handle cannot be retrieved.
- Message
notify: invalid listener callback handle
RunMat:NotifyArgumentLifetime- When
- Event data or an extra callback argument cannot be retained through dispatch.
- Message
notify: failed to retain callback arguments
Dispatch
The target must be a live handle object and the event name is case-sensitive text. The documented data form is an event.EventData subclass object; the runtime also accepts multiple callback arguments as a RunMat extension, rejected when extensions are disabled. Nested integer or resident values are passed as ordinary callback payloads, not converted or gathered by notify.
Listeners are snapshotted from the context-owned registry, and the receiver, callbacks, and nested event-data/extra arguments are rooted through dispatch. Listeners run sequentially through the semantic feval path with zero requested callback outputs. A callback can mutate workspace, objects, graphics, files, or external state, suspend, throw, or reenter notify. Those effects and capabilities are conservatively dynamic when registrations are not known statically.
A callback error propagates with its original cause. Earlier callbacks may already have executed, so failure or cancellation cannot authorize replay of notify. The runtime does not promise atomic rollback of callback effects.
Placement
Dispatch is a host-side fusion boundary and requires the process execution stack for callback reentry. Native and browser hosts share the semantic contract; worker/distributed transfer does not transfer the originating object's listener registry. No numeric provider kernel or implicit GPU materialization is performed by notify.
A statement with no requested output still dispatches. At most one optional status result is returned by RunMat; an explicitly requested status is an extension rejected when extensions are disabled, and is not a MATLAB event-data output.
Example
Notify a registered listener
h = new_handle_object('EventTarget'); listener = addlistener(h, 'Changed', @disp); status = notify(h, 'Changed');Using notify with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how notify changes the result.
Run a small notify example, explain the result, then change one input and compare the output.
FAQ
Can notify be retried after a callback error?⌄
No. Prior callbacks may already have run; the error is after-effect or conservatively unphased, never a proof that replay is safe.
Related Introspection functions
addlistener · addParameter · addprop · assignin · builtin · cancel · class · clear · clearAllMemoizedCaches · clearCache · clearvars · dbclear · dbstack · dbstatus · dbtype · eval · evalc · evalin · feval · findprop · func2str · functions · get.p · getcallinfo · getmethod · inputname · inputParser · isa · ischar · isdeployed · iskeyword · ismethod · isobject · isstring · isUnderlyingType · isvalid · keyboard · loadobj · localfunctions · matlab.metadata.DynamicProperty.delete · memoize · metaclass · mfilename · mislocked · mlock · munlock · namelengthmax · narginchk · nargoutchk · new_object · numArgumentsFromSubscript · onCleanup · parse · saveobj · set.p · stats · str2func · subsasgn · subsref · superclasses · underlyingType · verLessThan · version · which · who · whos
Source you can read
Every RunMat function's source is public. Read exactly how notify is executed, line by line, in Rust.
- View the source for notify in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.