On this page

    M

    process.ref

    History
    process.ref(maybeRefable): void
    Stability: 1Experimental
    Attributes
    maybeRefable:any
    An object that may be "refable".

    An object is "refable" if it implements the Node.js "Refable protocol". Specifically, this means that the object implements the Symbol.for('nodejs.ref') and Symbol.for('nodejs.unref') methods. "Ref'd" objects will keep the Node.js event loop alive, while "unref'd" objects will not. Historically, this was implemented by using ref() and unref() methods directly on the objects. This pattern, however, is being deprecated in favor of the "Refable protocol" in order to better support Web Platform API types whose APIs cannot be modified to add ref() and unref() methods but still need to support that behavior.