Skip to main content

ref

method MessagePort.prototype.ref
Jump to headingMessagePort.prototype.ref(): void

Opposite of unref(). Calling ref() on a previously unref()ed port does not let the program exit if it's the only active handle left (the default behavior). If the port is ref()ed, calling ref() again has no effect.

If listeners are attached or removed using .on('message'), the port is ref()ed and unref()ed automatically depending on whether listeners for the event exist.

Return Type Jump to heading

void
Back to top