mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #5690 from SebastianCoetzee/master
Update mithril.d.ts
This commit is contained in:
Vendored
+30
-18
@@ -8,19 +8,15 @@
|
||||
interface MithrilStatic {
|
||||
(selector: string, attributes: Object, children?: any): MithrilVirtualElement;
|
||||
(selector: string, children?: any): MithrilVirtualElement;
|
||||
prop<T>(value?: T): (value?: T) => T;
|
||||
prop<T>(promise: MithrilPromise<T>): MithrilPromiseProperty<T>;
|
||||
prop<T>(value?: T): (value?: T) => T;
|
||||
prop<T>(promise: MithrilPromise<T>): MithrilPromiseProperty<T>;
|
||||
withAttr(property: string, callback: (value: any) => void): (e: Event) => any;
|
||||
module(rootElement: Node, module: MithrilModule): void;
|
||||
trust(html: string): String;
|
||||
render(rootElement: Element, children?: any): void;
|
||||
render(rootElement: HTMLDocument, children?: any): void;
|
||||
redraw: MithrilRedraw;
|
||||
route(rootElement: Element, defaultRoute: string, routes: { [key: string]: MithrilModule }): void;
|
||||
route(rootElement: HTMLDocument, defaultRoute: string, routes: { [key: string]: MithrilModule }): void;
|
||||
route(path: string, params?: any, shouldReplaceHistory?: boolean): void;
|
||||
route(): string;
|
||||
route(element: Element, isInitialized: boolean): void;
|
||||
route: MithrilRoute;
|
||||
request(options: MithrilXHROptions): MithrilPromise<any>;
|
||||
deferred<T>(): MithrilDeferred<T>;
|
||||
sync<T>(promises: MithrilPromise<T>[]): MithrilPromise<T>;
|
||||
@@ -28,6 +24,22 @@ interface MithrilStatic {
|
||||
endComputation(): void;
|
||||
}
|
||||
|
||||
interface MithrilRoute {
|
||||
(rootElement: Element, defaultRoute: string, routes: { [key: string]: MithrilModule }): void;
|
||||
(rootElement: HTMLDocument, defaultRoute: string, routes: { [key: string]: MithrilModule }): void;
|
||||
(path: string, params?: any, shouldReplaceHistory?: boolean): void;
|
||||
(element: Element, isInitialized: boolean): void;
|
||||
(): string;
|
||||
mode: string;
|
||||
param: MithrilParam;
|
||||
buildQueryString(data: Object): string;
|
||||
parseQueryString(queryString: string): Object;
|
||||
}
|
||||
|
||||
interface MithrilParam {
|
||||
(param: string): string;
|
||||
}
|
||||
|
||||
interface MithrilRedraw {
|
||||
(): void;
|
||||
strategy: (value?: string) => string;
|
||||
@@ -40,26 +52,26 @@ interface MithrilVirtualElement {
|
||||
}
|
||||
|
||||
interface MithrilModule {
|
||||
controller: Function;
|
||||
view: (controller?: any) => MithrilVirtualElement;
|
||||
controller: Function;
|
||||
view: (controller?: any) => MithrilVirtualElement;
|
||||
}
|
||||
|
||||
interface MithrilDeferred<T> {
|
||||
resolve(value?: T): void;
|
||||
reject(value?: any): void;
|
||||
promise: MithrilPromise<T>;
|
||||
resolve(value?: T): void;
|
||||
reject(value?: any): void;
|
||||
promise: MithrilPromise<T>;
|
||||
}
|
||||
|
||||
interface MithrilPromise<T> {
|
||||
(value?: T): T;
|
||||
then<R>(successCallback?: (value: T) => R, errorCallback?: (value: any) => any): MithrilPromise<R>;
|
||||
then<R>(successCallback?: (value: T) => MithrilPromise<R>, errorCallback?: (value: any) => any): MithrilPromise<R>;
|
||||
(value?: T): T;
|
||||
then<R>(successCallback?: (value: T) => R, errorCallback?: (value: any) => any): MithrilPromise<R>;
|
||||
then<R>(successCallback?: (value: T) => MithrilPromise<R>, errorCallback?: (value: any) => any): MithrilPromise<R>;
|
||||
}
|
||||
|
||||
interface MithrilPromiseProperty<T> extends MithrilPromise<T> {
|
||||
(): T;
|
||||
(value: T): T;
|
||||
toJSON(): T;
|
||||
(): T;
|
||||
(value: T): T;
|
||||
toJSON(): T;
|
||||
}
|
||||
|
||||
interface MithrilXHROptions {
|
||||
|
||||
Reference in New Issue
Block a user