mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-10-23 01:55:25 +00:00
打通流程
This commit is contained in:
@@ -20,10 +20,28 @@ export enum Msg {
|
||||
export class PluginEvent {
|
||||
msg: Msg | null = null;
|
||||
data: any = null;
|
||||
|
||||
source: Page | null = null; // 事件发送的源头
|
||||
target: Page | null = null; // 事件要发送的目标
|
||||
|
||||
constructor(target: Page, msg: Msg, data?: any) {
|
||||
static check(event: PluginEvent, source: Page, target: Page) {
|
||||
return event && source && target && event.source === source && event.target === target;
|
||||
}
|
||||
|
||||
static reset(event: PluginEvent, source: Page | null, target: Page | null) {
|
||||
if (event && source && target) {
|
||||
event.source = source;
|
||||
event.target = target;
|
||||
}
|
||||
}
|
||||
|
||||
static finish(event: PluginEvent) {
|
||||
event.source = event.target = null;
|
||||
}
|
||||
|
||||
constructor(source: Page, target: Page, msg: Msg, data?: any) {
|
||||
if (PageInclude(target)) {
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
this.msg = msg;
|
||||
this.data = data || null;
|
||||
|
Reference in New Issue
Block a user