Skip to main content
Version: v3.0.0

proxy.has

Type: ProxyHasEvent

Triggered when the in operator is used on a proxy (e.g., "key" in proxy).

Data Properties

target

Traceable

The underlying target object.

property

ObjectKey

The property name or symbol being checked for existence.

result

boolean

Indicates whether the property exists on the target. This is the result of the has trap.

Example

import { Nexo } from "nexos";
import type * as nx from "nexos";

const nexo = new Nexo();
const proxy = nexo.create({ loaded: true });

nexo.on("proxy.has", (event: nx.ProxyHasEvent) => {
console.log(`Checking if '${event.data.property}' exists`);
});

console.log("loaded" in proxy); // Logs: Checking if 'loaded' exists