napi_object_freeze
napi_status napi_object_freeze(napi_env env,
napi_value object); [in] env:调用 Node-API 时所处的环境。[in] object:要冻结的对象。
如果 API 成功,则返回 napi_ok。
【Returns napi_ok if the API succeeded.】
此方法会冻结给定对象。这可以防止向对象添加新属性,防止删除现有属性,防止更改现有属性的可枚举性、可配置性或可写性,并防止更改现有属性的值。它还防止更改对象的原型。此内容在 ECMA-262 规范的 第 19.1.2.6 节 中有描述。
【This method freezes a given object. This prevents new properties from being added to it, existing properties from being removed, prevents changing the enumerability, configurability, or writability of existing properties, and prevents the values of existing properties from being changed. It also prevents the object's prototype from being changed. This is described in Section 19.1.2.6 of the ECMA-262 specification.】