timeout[Symbol.toPrimitive]()


  • 返回: <integer> 一个可用于引用此 timeout 的数字

Timeout 强制转换为原始值。该原始值可以用于清除 Timeout。原始值只能在创建该超时的同一线程中使用。因此,要在 worker_threads 跨线程使用它,必须先将其传递到正确的线程。这可以增强与浏览器 setTimeout()setInterval() 实现的兼容性。

【Coerce a Timeout to a primitive. The primitive can be used to clear the Timeout. The primitive can only be used in the same thread where the timeout was created. Therefore, to use it across worker_threads it must first be passed to the correct thread. This allows enhanced compatibility with browser setTimeout() and setInterval() implementations.】