Skip to content

Commit 1b1f6e9

Browse files
committed
refactor: ts format and fix spell mistake
1 parent 8b0a43c commit 1b1f6e9

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/apphook.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class AppHook {
104104
isCatch,
105105
};
106106

107-
this.addListner(ListenerType.Trigger, hook, trigger);
107+
this.addListener(ListenerType.Trigger, hook, trigger);
108108
return trigger;
109109
}
110110

@@ -185,7 +185,7 @@ export class AppHook {
185185
isCatch,
186186
};
187187

188-
this.addListner(ListenerType.Filter, hook, filter);
188+
this.addListener(ListenerType.Filter, hook, filter);
189189

190190
return filter;
191191
}
@@ -199,7 +199,7 @@ export class AppHook {
199199
* @param {IListener} newListener
200200
* @memberof AppHook
201201
*/
202-
private addListner(type: ListenerType, hook: string, newListener: IListener) {
202+
private addListener(type: ListenerType, hook: string, newListener: IListener) {
203203
// listeners of the type
204204
let typeListners = this._listeners[type];
205205
if (typeListners === undefined) {
@@ -245,7 +245,7 @@ export class AppHook {
245245
const listenerList = typeListners[listener.hook];
246246
if (listenerList === undefined) {
247247
return false;
248-
}
248+
}
249249
for (let i = 0; i < listenerList.length; i++) {
250250
const l = listenerList[i];
251251
if (l === listener) {
@@ -388,20 +388,20 @@ export class AppHook {
388388
if (filterList === undefined) {
389389
return defaultValue;
390390
}
391-
let filterdValue = defaultValue;
391+
let filteredValue = defaultValue;
392392
for (let i = 0; i < filterList.length; i++) {
393393
const filter = filterList[i] as IFilter;
394394
if (filter.isCatch === undefined || filter.isCatch === false) {
395-
filterdValue = filter.action.command(filterdValue, hookState, filter.action.args);
395+
filteredValue = filter.action.command(filteredValue, hookState, filter.action.args);
396396
} else {
397397
try {
398-
filterdValue = filter.action.command(filterdValue, hookState, filter.action.args);
398+
filteredValue = filter.action.command(filteredValue, hookState, filter.action.args);
399399
} catch (e) {
400400
console.error(e);
401401
}
402402
}
403403
}
404-
return filterdValue;
404+
return filteredValue;
405405
}
406406

407407
}

src/hook_events.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ import { FilterCommand, TriggerCommand } from './commands';
1010
import { IRule } from './rules';
1111

1212
export type AddTriggerEvent = (hook: string,
13-
command: TriggerCommand,
14-
commandArg: any,
15-
rule: IRule | undefined,
16-
priority: number,
17-
isCatch: boolean) => void;
13+
command: TriggerCommand,
14+
commandArg: any,
15+
rule: IRule | undefined,
16+
priority: number,
17+
isCatch: boolean) => void;
1818

1919
export type AddFilterEvent = (hook: string,
20-
command: FilterCommand,
21-
commandArg: any,
22-
rule: IRule | undefined,
23-
priority: number,
24-
isCatch: boolean) => void;
20+
command: FilterCommand,
21+
commandArg: any,
22+
rule: IRule | undefined,
23+
priority: number,
24+
isCatch: boolean) => void;
2525

2626
export type DoTriggerEvent = (hook: string, hookState?: any) => void;
2727

0 commit comments

Comments
 (0)