export class JumpInfoInterceptor implements IHMInterceptor {
handle(info: HMInterceptorInfo): HMInterceptorAction {
let connectionInfo: string = '';
if(info.type === HMActionType.PUSH) {
connectionInfo = 'jump to';
} else {
connectionInfo = 'back to';
}
console.log(`${info.srcName} ${connectionInfo} ${info.targetName}`);
return HMInterceptorAction.DO_NEXT;
}
}
这里主要是通过HMInterceptorInfo.type 来判断。type一共有三种
export declare class HMActionType {
static POP: string;
static PUSH: string;
static REPLACE: string;
}