UNPKG

3.15 kBTypeScriptView Raw
1export interface PluginConfig {
2 /**
3 * Plugin name, this should match the class name
4 */
5 pluginName: string;
6 /**
7 * Plugin NPM package name
8 */
9 plugin: string;
10 /**
11 * Plugin object reference
12 */
13 pluginRef?: string;
14 /**
15 * Github repository URL
16 */
17 repo?: string;
18 /**
19 * Custom install command
20 */
21 install?: string;
22 /**
23 * Available installation variables
24 */
25 installVariables?: string[];
26 /**
27 * Supported platforms
28 */
29 platforms?: string[];
30 [key: string]: any;
31}
32export interface CordovaOptions {
33 destruct?: boolean;
34 /**
35 * Set to true if the wrapped method is a sync function
36 */
37 sync?: boolean;
38 /**
39 * Callback order. Set to reverse if the success/error callbacks are the first 2 arguments that the wrapped method
40 * takes.
41 */
42 callbackOrder?: 'reverse';
43 /**
44 * Callback style
45 */
46 callbackStyle?: 'node' | 'object';
47 /**
48 * Set a custom index for the success callback function. This doesn't work if callbackOrder or callbackStyle are set.
49 */
50 successIndex?: number;
51 /**
52 * Set a custom index for the error callback function. This doesn't work if callbackOrder or callbackStyle are set.
53 */
54 errorIndex?: number;
55 /**
56 * Success function property name. This must be set if callbackStyle is set to object.
57 */
58 successName?: string;
59 /**
60 * Error function property name. This must be set if callbackStyle is set to object.
61 */
62 errorName?: string;
63 /**
64 * Set to true to return an observable
65 */
66 observable?: boolean;
67 /**
68 * If observable is set to true, this can be set to a different function name that will cancel the observable.
69 */
70 clearFunction?: string;
71 /**
72 * This can be used if clearFunction is set. Set this to true to call the clearFunction with the same arguments used
73 * in the initial function.
74 */
75 clearWithArgs?: boolean;
76 /**
77 * Creates an observable that wraps a global event. Replaces document.addEventListener
78 */
79 eventObservable?: boolean;
80 /**
81 * Event name, this must be set if eventObservable is set to true
82 */
83 event?: string;
84 /**
85 * Element to attach the event listener to, this is optional, defaults to `window`
86 */
87 element?: any;
88 /**
89 * Set to true if the wrapped method returns a promise
90 */
91 otherPromise?: boolean;
92 /**
93 * Supported platforms
94 */
95 platforms?: string[];
96}
97export declare const Plugin: (config: PluginConfig) => ClassDecorator;
98export declare const Cordova: (config?: CordovaOptions) => MethodDecorator;
99export declare const CordovaProperty: () => PropertyDecorator;
100export declare const CordovaInstance: (config?: CordovaOptions) => MethodDecorator;
101export declare const InstanceProperty: () => PropertyDecorator;
102export declare const CordovaCheck: (config?: CordovaOptions) => MethodDecorator;
103export declare const InstanceCheck: (config?: CordovaOptions) => MethodDecorator;
104export declare const CordovaFunctionOverride: () => MethodDecorator;