那里。
根据 ZoneSpec 接口(interface)的注释(位于 zone.ts 文件中),onInvoke 钩子(Hook)必须接收 currentZone 作为第二个参数。如果我创建拦截器区域,则对该区域的引用应作为第二个参数传递。
以下是文档摘录:
/* Allows interception of the callback invocation.
@param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
@param currentZone The current [Zone] where the current interceptor has beed declared.
@param targetZone The [Zone] which originally received the request.
@param delegate The argument passed into the run method.
@param applyThis The argument passed into the run method.
@param applyArgs The argument passed into the run method.
@param source The argument passed into the run method.
*/
onInvoke?:
(parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone, delegate: Function,
applyThis: any, applyArgs: any[], source: string) => any;
我创建了一个interceptZone,我想它应该作为当前区域传递给我的钩子(Hook)方法。但由于某种原因,我收到与 targetZone 相同的值。 我创建了一个演示HERE ,它描述了所描述的问题。
我错过了什么吗?
最佳答案
这是库中的一个错误。开发商证实了这一点。 详情为HERE
关于javascript - Zone.js 将错误的 currentZone 值传递给 onInvoke Hook ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41103946/