forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
egg.js.d.ts
93 lines (90 loc) · 4.12 KB
/
egg.js.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Type definitions for Egg.js 0.0.1
// Project: https://github.com/mikeflynn/egg.js/
// Definitions by: Markus Peloso <https://github.com/ToastHawaii/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare var egg: Egg;
declare module "egg" {
export = egg;
}
/**
* Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter
* eggs by watching the user's key strokes.
*/
declare class Egg {
/**
* Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter
* eggs by watching the user's key strokes.
*/
constructor();
/**
* Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter
* eggs by watching the user's key strokes.
* @param keySequence You need to pass it the character sequence to trigger the easter egg
* callback (which can either be in plain English or JavaScript key codes).
* @param fn A function to trigger when it happens.
*/
constructor(keySequence: string, fn: () => any);
/**
* Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter
* eggs by watching the user's key strokes.
* @param keySequence You need to pass it the character sequence to trigger the easter egg
* callback (which can either be in plain English or JavaScript key codes).
* @param fn A function to trigger when it happens.
* @param metadata An optional set of metadata.
*/
constructor(keySequence: string, fn: () => any, metadata: any);
/**
* Use to add in your easter eggs.
* @param keySequence You need to pass it the character sequence to trigger the easter egg
* callback (which can either be in plain English or JavaScript key codes).
* @param fn A function to trigger when it happens.
*/
AddCode(keySequence: string, fn: () => any): Egg;
/**
* Use to add in your easter eggs.
* @param keySequence You need to pass it the character sequence to trigger the easter egg
* callback (which can either be in plain English or JavaScript key codes).
* @param fn A function to trigger when it happens.
* @param metadata An optional set of metadata.
*/
AddCode(keySequence: string, fn: () => any, metadata: any): Egg;
/**
* Add a hook, that will run after any egg code is triggered. You could use it to fire a Google
* Analytics event or send out a tweet that someone finally found your easter egg. Hooks get
* access to the whole Egg.js object so you can pull information about the easter egg that
* fired via this.activeEgg.
* @param fn A function to trigger when it happens.
*/
AddHook(fn: () => any): Egg;
/**
* Start listening to key codes.
*/
Listen(): Egg;
/**
* Use to add in your easter eggs.
* @param keySequence You need to pass it the character sequence to trigger the easter egg
* callback (which can either be in plain English or JavaScript key codes).
* @param fn A function to trigger when it happens.
*/
addCode(keySequence: string, fn: () => any): Egg;
/**
* Use to add in your easter eggs.
* @param keySequence You need to pass it the character sequence to trigger the easter egg
* callback (which can either be in plain English or JavaScript key codes).
* @param fn A function to trigger when it happens.
* @param metadata An optional set of metadata.
*/
addCode(keySequence: string, fn: () => any, metadata: any): Egg;
/**
* Add a hook, that will run after any egg code is triggered. You could use it to fire a Google
* Analytics event or send out a tweet that someone finally found your easter egg. Hooks get
* access to the whole Egg.js object so you can pull information about the easter egg that
* fired via this.activeEgg.
* @param fn A function to trigger when it happens.
*/
addHook(fn: () => any): Egg;
/**
* Start listening to key codes.
*/
listen(): Egg;
}