UNPKG

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