domain.add(emitter)


显式地添加触发器到域中。 如果触发器调用的任何事件句柄抛出错误,或者触发器触发 'error' 事件,则它将被路由到域的 'error' 事件,就像隐式绑定一样。

这也适用于从 setInterval()setTimeout() 返回的定时器。 如果其回调函数抛出异常,则其将被域 'error' 句柄捕获。

如果定时器或 EventEmitter 已绑定到某个域,则将其从该域中删除,并改为绑定到该域。

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.

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.

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