Skip to content

Commit

Permalink
add name to hook interface
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jul 9, 2019
1 parent 577543a commit acfb72e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class Hook {
Object.assign({}, options, typeof opt === "string" ? { name: opt } : opt);

return {
name: this.name,
tap: (opt, fn) => this.tap(mergeOptions(opt), fn),
tapAsync: (opt, fn) => this.tapAsync(mergeOptions(opt), fn),
tapPromise: (opt, fn) => this.tapPromise(mergeOptions(opt), fn),
Expand Down
1 change: 1 addition & 0 deletions tapable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type ArgumentNames<T extends any[]> = FixedSizeArray<T["length"], string>;

declare class Hook<T, R> {
constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
name: string | undefined;
intercept(interceptor: HookInterceptor<Hook<T, R>>): void;
isUsed(): boolean;
callAsync(...args: Append<AsArray<T>, Callback<Error, R>>): void;
Expand Down

0 comments on commit acfb72e

Please sign in to comment.