Skip to main content
Version: v1.1.0

Class: ProxyWrapper

Defined in: src/utils/ProxyWrapper.ts:15

A wrapper class that manages a proxy and its associated events. The ProxyWrapper encapsulates the functionality of proxy operations and ensures that event listeners are triggered appropriately. It also provides the ability to revoke the proxy and manage traceability.

Example

const proxyWrapper = new ProxyWrapper({ id: 'proxy1', nexo: someNexoInstance, traceable: true, revoke: revokeFunction });
proxyWrapper.revoke(); // This will revoke the proxy.

Extends

Constructors

new ProxyWrapper()

new ProxyWrapper(data): ProxyWrapper

Defined in: src/utils/ProxyWrapper.ts:44

Creates an instance of ProxyWrapper. This constructor initializes the wrapper with the provided data and sets up the proxy's traceability. If the proxy is not traceable, a sandbox is created.

Parameters

data

The data for initializing the proxy wrapper, including id, nexo, traceable flag, and revoke function.

id

string

nexo

Nexo

revoke

VoidFunction

traceable

boolean

Returns

ProxyWrapper

Example

const proxyWrapper = new ProxyWrapper({ id: 'proxy1', nexo: someNexoInstance, traceable: true, revoke: revokeFunction });
// Initializes the ProxyWrapper instance.

Overrides

NexoEmitter.constructor

Properties

id

readonly id: string

Defined in: src/utils/ProxyWrapper.ts:17

The unique identifier for the proxy wrapper.


nexo

readonly nexo: Nexo

Defined in: src/utils/ProxyWrapper.ts:20

The Nexo instance associated with this proxy wrapper.


sandbox

readonly sandbox: void | object

Defined in: src/utils/ProxyWrapper.ts:26

The sandbox for the proxy if it is not traceable, otherwise undefined.


traceable

readonly traceable: boolean

Defined in: src/utils/ProxyWrapper.ts:23

A flag indicating if the proxy is traceable.

Accessors

revoked

Get Signature

get revoked(): boolean

Defined in: src/utils/ProxyWrapper.ts:86

A getter that returns whether the proxy has been revoked. This value is true if the proxy was revoked, otherwise false.

Example
const isRevoked = proxyWrapper.revoked; // Checks if the proxy is revoked.
Returns

boolean

true if the proxy is revoked, false otherwise.

Methods

revoke()

revoke(): void

Defined in: src/utils/ProxyWrapper.ts:70

Revokes the proxy, triggering the revoke function and marking the proxy as revoked. Once revoked, the proxy can no longer be used for its original operations.

Returns

void

Example

proxyWrapper.revoke(); // Revokes the proxy and prevents further use.