Skip to content

Commit ecd0edc

Browse files
committed
Merge pull request soywiz-archive#8 from bonnici/master
Re-added post functions to request.d.ts
2 parents 902b17f + b9d2b8f commit ecd0edc

10 files changed

+280
-706
lines changed

cheerio.d.ts

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
module "cheerio" {
2+
export import cheerio = module("cheerio");
3+
4+
function load(body: string, opts?: CheerioOpt) : CheerioObj;
5+
function (selector: string, body: string): CheerioObj;
6+
function (selector: string, context: string, root: string): CheerioObj;
7+
8+
interface CheerioOpt {
9+
ignoreWhitespace: bool;
10+
xmlMode: bool;
11+
lowerCaseTags: bool;
12+
}
13+
14+
interface CheerioObj {
15+
// Selectors
16+
(selector: string, context?: string, root?: string): CheerioSelector;
17+
(selector: string, context?: CheerioObj, root?: string): CheerioSelector;
18+
(selector: CheerioObj, context?: string, root?: string): CheerioSelector;
19+
(selector: CheerioObj, context?: CheerioObj, root?: string): CheerioSelector;
20+
21+
// Rendering
22+
html(selector?: string): string;
23+
24+
// Utilities
25+
root(): CheerioSelector;
26+
dom(): any;
27+
isArray(obj: any): bool;
28+
inArray(elem: any, array: any[]): number;
29+
makeArray(obj: any): any[];
30+
each(collection: any, callback: (indexInArray: any, valueOfElement: any) => any): any;
31+
merge(first: any[], second: any[]): any[];
32+
}
33+
34+
interface CheerioSelector {
35+
// Array functions
36+
length: number;
37+
[x: string]: HTMLElement;
38+
[x: number]: HTMLElement;
39+
40+
// Attributes
41+
attr(attributeName: string, value: any): CheerioSelector;
42+
attr(map: { [key: any]: any; }): string;
43+
attr(attributeName: string, func: (index: any, attr: any) => any): CheerioSelector;
44+
45+
removeAttr(attributeName: any): CheerioSelector;
46+
47+
hasClass(className: string): bool;
48+
49+
addClass(classNames: string): CheerioSelector;
50+
addClass(func: (index: any, currentClass: any) => CheerioSelector);
51+
52+
removeClass(className?: any): CheerioSelector;
53+
removeClass(func: (index: any, cls: any) => any): CheerioSelector;
54+
55+
// Traversing
56+
find(selector: string): CheerioSelector;
57+
find(element: any): CheerioSelector;
58+
find(obj: CheerioSelector): CheerioSelector;
59+
60+
parent(selector?: string): CheerioSelector;
61+
62+
next(selector?: string): CheerioSelector;
63+
64+
prev(selector?: string): CheerioSelector;
65+
66+
siblings(selector?: string): CheerioSelector;
67+
68+
children(selector?: any): CheerioSelector;
69+
70+
each(func: (index: any, elem: Element) => CheerioSelector);
71+
72+
map(callback: (index: any, domElement: Element) =>any): CheerioSelector;
73+
74+
filter(selector: string): CheerioSelector;
75+
filter(func: (index: any) =>any): CheerioSelector;
76+
filter(element: any): CheerioSelector;
77+
filter(obj: CheerioSelector): CheerioSelector;
78+
79+
first(): CheerioSelector;
80+
81+
last(): CheerioSelector;
82+
83+
eq(index: number): CheerioSelector;
84+
85+
// Manipulation
86+
append(...content: any[]): CheerioSelector;
87+
append(func: (index: any, html: any) => any);
88+
89+
prepend(...content: any[]): CheerioSelector;
90+
prepend(func: (index: any, html: any) =>any): CheerioSelector;
91+
92+
after(...content: any[]): CheerioSelector;
93+
after(func: (index: any) => any);
94+
95+
before(...content: any[]): CheerioSelector;
96+
before(func: (index: any) => any);
97+
98+
remove(selector?: any): CheerioSelector;
99+
100+
replaceWith(content: any): CheerioSelector;
101+
102+
empty(): CheerioSelector;
103+
104+
html(htmlString: string): CheerioSelector;
105+
html(): string;
106+
107+
text(textString: string): CheerioSelector;
108+
text(): string;
109+
110+
// Miscellaneous
111+
toArray(): any[];
112+
113+
clone(): CheerioSelector;
114+
}
115+
}

cron.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module "cron" {
2+
class CronJob {
3+
constructor (cronTime: string, onTick: () => any, onComplete?: () => any,
4+
start?: bool, timezone?: string, context?: any);
5+
constructor (cronTime: Date, onTick: () => any, onComplete?: () => any,
6+
start?: bool, timezone?: string, context?: any);
7+
8+
start();
9+
stop();
10+
}
11+
}

gently.d.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module "gently" {
2+
export import gently = module("gently");
3+
4+
function new(): Gently;
5+
6+
class Gently {
7+
hijacked: any[];
8+
9+
expect(obj: any, method: string, stubFn?: (...args: any[]) => any): (...args: any[]) => any;
10+
expect(obj: any, method: string, count: number, stubFn: (...args: any[]) => any): (...args: any[]) => any;
11+
12+
restore(obj: any, method: string): void;
13+
14+
hijack(realRequire: (id: string) => any): (id: string) => any;
15+
16+
stub(location: string, exportsName?: string): any;
17+
18+
verify(msg?: string): void;
19+
}
20+
}

0 commit comments

Comments
 (0)