forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hooker.d.ts
42 lines (33 loc) · 1.35 KB
/
hooker.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Type definitions for JavaScript Hooker v0.2.3
// Project: https://github.com/cowboy/javascript-hooker
// Definitions by: Michael Zabka <https://github.com/misak113/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare type HookerPostHookFunction = (result: any, ...args: any[]) => IHookerPostHookResult|void;
declare type HookerPreHookFunction = (...args: any[]) => IHookerPreHookResult|void;
declare module "hooker" {
function hook(object: any, props: string|string[], options: IHookerOptions): void;
function hook(object: any, props: string|string[], prehookFunction: HookerPreHookFunction): void;
function unhook(object: any, props?: string|string[]): string[];
function orig(object: any, props: string|string[]): Function;
function override(value: any): HookerOverride;
function preempt(value: any): HookerPreempt;
function filter(context: any, args: any[]): HookerFilter;
}
declare class HookerOverride implements IHookerPostHookResult, IHookerPreHookResult {
value: any;
}
declare class HookerPreempt implements IHookerPreHookResult {
value: any;
}
declare class HookerFilter implements IHookerPreHookResult {
context: any;
args: any[];
}
interface IHookerPostHookResult {}
interface IHookerPreHookResult {}
interface IHookerOptions {
pre?: HookerPreHookFunction;
post?: HookerPostHookFunction;
once?: boolean;
passName?: boolean;
}