Stability: 1 - Experimental

    1. napi_status napi_object_freeze(napi_env env,
    2. 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 of the ECMA-262 specification.