forked from sv01a/TypeScript-Knockoutjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathknockout.d.ts
104 lines (97 loc) · 3.86 KB
/
knockout.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
94
95
96
97
98
99
100
101
102
103
104
module knockout {
interface koSubscription{
dispose();
};
interface koExtendOptions {
throttle?: number;
};
interface koExtend {
();
extend(options:koExtendOptions);
}
interface koComputedOptions {
read?: () =>any;
write?: () =>void;
owner?: any;
};
export interface koComputed {
(evaluator: () => any): koExtend;
(options: koComputedOptions): koExtend;
(): any;
};
export interface koObservable {
(value: number): {
(newValue: number): void;
(): number;
subscribe(callback: (newValue: number) => void ):koSubscription;
};
(value: string): {
(newValue: string): void;
(): string;
subscribe(callback: (newValue: string) => void ):koSubscription;
};
(value: bool): {
(newValue: bool): void;
(): bool;
subscribe(callback: (newValue: bool) => void ):koSubscription;
};
(value: any): {
(newValue: any): void;
(): any;
subscribe(callback: (newValue: any) => void ):koSubscription;
};
};
export interface koObservableArray {
(array: Array): {
(newValue: Array): void;
(): Array;
subscribe(callback: (newValue: Array) => void ): koSubscription;
pop(): any;
push(...items: any[]): void;
reverse(): any[];
shift(): any;
slice(start: number, end?: number): any[];
sort(compareFn?: (a, b) => number): any[];
splice(start: number): string[];
splice(start: number, deleteCount: number, ...items: any[]): any[];
unshift(...items: any[]): number;
indexOf(item): number;
remove(value):any;
remove(predicate: (value) =>bool): any;
removeAll();
removeAll(arrayOfValues: any[]):any[];
destroy(value);
destroy(predicate: (value) =>bool): any;
destroyAll();
destroyAll(arrayOfValues: any[]):any[];
replace(oldItem, newItem);
};
};
export function applyBindings(viewModel?, rootNode?: HTMLElement);
export function toJSON(viewModel, replacer?, space?):string;
export function toJS(viewModel): Object;
export var observable: koObservable;
export var computed: koComputed;
export var observableArray: koObservableArray;
};
module knockout.utils {
export var fieldsIncludedWithJsonPost:any[];
export function extend(target, source);
export function arrayForEach(array: any[], action: (any) =>void );
export function arrayIndexOf(array: any[], item: any);
export function arrayFirst(array: any[], predicate: (item) =>bool, predicateOwner? ): any;
export function arrayFilter(array: any[], predicate: (item) =>bool);
export function arrayGetDistinctValues(array: any[]);
export function arrayMap(array: any[], mapping:(item)=>any);
export function arrayPushAll(array: any[],valuesToPush: any[]);
export function arrayRemoveItem(array: any[], itemToRemove);
export function getFormFields(form: HTMLFormElement, fieldName: string): HTMLElement[];
export function parseJson(jsonString:string):Object;
export function registerEventHandler(element: HTMLElement, eventType: string, handler: (event: Event) =>void );
export function stringifyJson(data, replacer?, space?);
export function range(min: number, max: number);
export function toggleDomNodeCssClass(node:HTMLElement, className:string, shouldHaveClass?:bool);
export function triggerEvent(element: HTMLElement, eventType: string);
export function unwrapObservable(value);
};
declare var ko: knockout;