Skip to main content
Version: next

proxy.preventExtensions

Type: ProxyPreventExtensionsEvent

Triggered when Object.preventExtensions(proxy) is called to make the proxy (and its target) non-extensible.

Data Properties

target

Traceable

The underlying target object.

result

boolean

Indicates whether the operation to prevent extensions was successful. If true, new properties can no longer be added to the target object.

Example

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

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

nexo.on("proxy.preventExtensions", (event: nx.ProxyPreventExtensionsEvent) => {
console.log("Preventing extensions");
});

Object.preventExtensions(proxy); // Logs: Preventing extensions