Function: createActorProxy()
API / @xmachines/play-view / index / createActorProxy
function createActorProxy<TActor>(getActor): TActor;Defined in: packages/play-view/src/actor-proxy.ts:32
Makes a proxy that behaves like the current actor.
- A read, a write, a definition (
Object.defineProperty), a delete, and a membership test (in) reach the current actor. - An enumeration (
Object.keys, a spread) lists the own keys of the current actor. instanceofanswers with the prototype of the current actor.Object.preventExtensionsandObject.freezethrow aTypeError. The proxy stands for each actor of the props in turn, so it cannot promise a fixed set of keys.- A method comes back bound to the current actor, so
thisand a private field work as in a direct call. The proxy keeps one bound method for each actor and method, so a repeated read returns the SAME function (actor.send === actor.send).
Type Parameters
| Type Parameter |
|---|
TActor extends object |
Parameters
| Parameter | Type | Description |
|---|---|---|
getActor | () => TActor | Returns the actor of the props. The proxy calls it at each access. |
Returns
TActor
The proxy.