module.evaluate([options])


  • options <Object>
    • timeout <integer> 指定在终止执行之前评估的毫秒数。如果执行被中断,将抛出 Error。此值必须是严格正整数。
    • breakOnSigint <boolean> 如果为 true,接收到 SIGINTCtrl+C)将终止执行并抛出一个 Error。在脚本执行期间,通过 process.on('SIGINT') 附加的现有事件处理程序将被禁用,但在脚本执行后仍然继续工作。默认值: false
  • 返回:<Promise> 成功时返回 undefined

评估模块。

【Evaluate the module.】

必须在模块已链接后调用此方法;否则将会被拒绝。它也可以在模块已经被评估之后调用,在这种情况下,如果初始评估成功结束(module.status'evaluated'),它将什么也不做;如果初始评估导致了异常(module.status'errored'),它将重新抛出该异常。

【This must be called after the module has been linked; otherwise it will reject. It could be called also when the module has already been evaluated, in which case it will either do nothing if the initial evaluation ended in success (module.status is 'evaluated') or it will re-throw the exception that the initial evaluation resulted in (module.status is 'errored').】

在模块正在被评估时(module.status'evaluating'),无法调用此方法。

【This method cannot be called while the module is being evaluated (module.status is 'evaluating').】

对应 ECMAScript 规范中 循环模块记录Evaluate() 具体方法 字段。

【Corresponds to the Evaluate() concrete method field of Cyclic Module Records in the ECMAScript specification.】