diff options
Diffstat (limited to 'doc/api/n-api.md')
-rw-r--r-- | doc/api/n-api.md | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md index a8620c209c..5cfebd60dc 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -4092,6 +4092,53 @@ this API will set the properties on the object one at a time, as defined by `DefineOwnProperty()` (described in [Section 9.1.6][] of the ECMA-262 specification). +#### napi_object_freeze +<!-- YAML +added: REPLACEME +--> + +> Stability: 1 - Experimental + +```c +napi_status napi_object_freeze(napi_env env, + napi_value object); +``` + +* `[in] env`: The environment that the N-API call is invoked under. +* `[in] object`: The object to freeze. + +Returns `napi_ok` if the API succeeded. + +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](https://tc39.es/ecma262/#sec-object.freeze) of the +ECMA-262 specification. + +#### napi_object_seal +<!-- YAML +added: REPLACEME +--> + +> Stability: 1 - Experimental + +```c +napi_status napi_object_seal(napi_env env, + napi_value object); +``` + +* `[in] env`: The environment that the N-API call is invoked under. +* `[in] object`: The object to seal. + +Returns `napi_ok` if the API succeeded. + +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](https://tc39.es/ecma262/#sec-object.seal) +of the ECMA-262 specification. + ## Working with JavaScript functions N-API provides a set of APIs that allow JavaScript code to |