Function: attachRenderErrorHandler()
API / @xmachines/play-actor / attachRenderErrorHandler
function attachRenderErrorHandler<TRegistry>(registry, handler): TRegistry;Defined in: packages/play-actor/src/provider-guards.ts:68
Copies a component registry, and puts an onRenderError handler into the copy.
The function defines the handler as an own property of the copy. That property is
not enumerable, and it is configurable (D-19 gives one convention of the
injection for every framework renderer). The handler therefore replaces each
handler of the defineRegistry level, and it does not appear in an enumeration of
the component entries of the registry.
The function never changes the registry of the caller: it returns a shallow copy.
Therefore a caller that needs a handler for each instance, such as an
onRenderError prop of ActorProvider, can share one result of defineRegistry
between the providers in a safe way.
Type Parameters
| Type Parameter | Description |
|---|---|
TRegistry extends object | The component registry type of the framework. |
Parameters
| Parameter | Type | Description |
|---|---|---|
registry | TRegistry | The component registry from defineRegistry().registry. |
handler | RenderErrorHandler | The renderer calls it with (error, componentName) when a catalog component throws during a render. |
Returns
TRegistry
A shallow copy of registry, with onRenderError on it.