|
| 1 | +// Type definitions for Apache Cordova |
| 2 | +// Project: http://cordova.apache.org |
| 3 | +// Definitions by: Microsoft Open Technologies Inc. <http://msopentech.com> |
| 4 | +// Definitions: https://github.com/borisyankov/DefinitelyTyped |
| 5 | +// |
| 6 | +// Copyright (c) Microsoft Open Technologies, Inc. |
| 7 | +// Licensed under the MIT license. |
| 8 | + |
| 9 | +interface Cordova { |
| 10 | + /** Invokes native functionality by specifying corresponding service name, action and optional parameters. |
| 11 | + * @param success A success callback function. |
| 12 | + * @param fail An error callback function. |
| 13 | + * @param service The service name to call on the native side (corresponds to a native class). |
| 14 | + * @param action The action name to call on the native side (generally corresponds to the native class method). |
| 15 | + * @param args An array of arguments to pass into the native environment. |
| 16 | + */ |
| 17 | + exec(success: () => any, fail: () => any, service: string, action: string, args?: string[]): void; |
| 18 | + /** Gets the operating system name. */ |
| 19 | + platformId: string; |
| 20 | + /** Gets Cordova framework version */ |
| 21 | + version: string; |
| 22 | + /** Defines custom logic as a Cordova module. Other modules can later access it using module name provided. */ |
| 23 | + define(moduleName: string, factory: (require: any, exports: any, module: any) => any): void; |
| 24 | + /** Access a Cordova module by name. */ |
| 25 | + require(moduleName: string): any; |
| 26 | + /** Namespace for Cordova plugin functionality */ |
| 27 | + plugins:CordovaPlugins; |
| 28 | +} |
| 29 | + |
| 30 | +interface CordovaPlugins {} |
| 31 | + |
| 32 | +interface Document { |
| 33 | + addEventListener(type: "deviceready", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 34 | + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 35 | + addEventListener(type: "resume", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 36 | + addEventListener(type: "backbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 37 | + addEventListener(type: "menubutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 38 | + addEventListener(type: "searchbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 39 | + addEventListener(type: "startcallbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 40 | + addEventListener(type: "endcallbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 41 | + addEventListener(type: "volumedownbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 42 | + addEventListener(type: "volumeupbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 43 | + |
| 44 | + removeEventListener(type: "deviceready", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 45 | + removeEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 46 | + removeEventListener(type: "resume", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 47 | + removeEventListener(type: "backbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 48 | + removeEventListener(type: "menubutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 49 | + removeEventListener(type: "searchbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 50 | + removeEventListener(type: "startcallbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 51 | + removeEventListener(type: "endcallbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 52 | + removeEventListener(type: "volumedownbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 53 | + removeEventListener(type: "volumeupbutton", listener: (ev: Event) => any, useCapture?: boolean): void; |
| 54 | + |
| 55 | + addEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void; |
| 56 | + removeEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void; |
| 57 | +} |
| 58 | + |
| 59 | +interface Window { |
| 60 | + cordova:Cordova; |
| 61 | +} |
| 62 | + |
| 63 | +// cordova/argscheck module |
| 64 | +interface ArgsCheck { |
| 65 | + checkArgs(argsSpec: string, functionName: string, args: any[], callee?: any): void; |
| 66 | + getValue(value?: any, defaultValue?: any): any; |
| 67 | + enableChecks: boolean; |
| 68 | +} |
| 69 | + |
| 70 | +// cordova/urlutil module |
| 71 | +interface UrlUtil { |
| 72 | + makeAbsolute(url: string): string |
| 73 | +} |
| 74 | + |
| 75 | +/** Apache Cordova instance */ |
| 76 | +declare var cordova: Cordova; |
| 77 | + |
| 78 | +declare module 'cordova' { |
| 79 | + export = cordova; |
| 80 | +} |
0 commit comments