timeout[Symbol.toPrimitive]()
-
返回:<integer> 可用于引用此
timeout
的数字¥Returns: <integer> a number that can be used to reference this
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.