napi_object_seal
napi_status napi_object_seal(napi_env env,
napi_value object);
-
[in] env
:调用 Node-API 调用的环境。¥
[in] env
: The environment that the Node-API call is invoked under. -
[in] object
:要封印的对象。¥
[in] object
: The object to seal.
如果 API 成功,则返回 napi_ok
。
¥Returns napi_ok
if the API succeeded.
此方法密封给定的对象。这可以防止向其添加新属性,以及将所有现有属性标记为不可配置。这在 ECMA-262 规范的 第 19.1.2.20 节 中进行了描述。
¥This method seals a given object. This prevents new properties from being added to it, as well as marking all existing properties as non-configurable. This is described in Section 19.1.2.20 of the ECMA-262 specification.