domain.add(emitter)


明确地将一个触发器添加到域中。如果由触发器调用的任何事件处理程序抛出错误,或者触发器发出 'error' 事件,它将像隐式绑定一样被路由到域的 'error' 事件。

【Explicitly adds an emitter to the domain. If any event handlers called by the emitter throw an error, or if the emitter emits an 'error' event, it will be routed to the domain's 'error' event, just like with implicit binding.】

这同样适用于从 setInterval()setTimeout() 返回的定时器。如果它们的回调函数抛出错误,将会被域的 'error' 处理程序捕获。

【This also works with timers that are returned from setInterval() and setTimeout(). If their callback function throws, it will be caught by the domain 'error' handler.】

如果计时器或 EventEmitter 已经绑定到了某个域,它会从该域中移除,并绑定到这个域。

【If the Timer or EventEmitter was already bound to a domain, it is removed from that one, and bound to this one instead.】