那里。
根据ZoneSpec接口(位于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,它描述了所描述的问题。
我错过了什么吗?