-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWKdova.d.ts
123 lines (114 loc) · 2.93 KB
/
WKdova.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// WKdova.d.ts
export interface App {
/** App name */
name: string;
/** App version */
version: string;
/** App build */
build: string;
/** App bundle ID */
bundleid: string;
}
export interface Device {
/** Device name */
name: string;
/** Readable model*/
model: string;
/** Model identifier */
modelIdentifier: string;
/** iOS Version */
version: string;
/** Platform is always iOS */
platform: string;
/** UUID, will change if device is uninstalled, see identifierForVendor for more */
uuid: string;
/** true if in Simulator */
isVirtual: boolean;
/** The preferred language, for example "en-US". Should be the same as navigator.language */
language: string;
/** Country code, for example "US" */
region: string;
/** Timezone, for example "Europe/Zurich" */
timezone: string;
}
interface StringMap { [key: string]: string; }
export interface Service {
name: string;
hostname: string;
port: number;
txtRecord: StringMap;
}
export interface Position {
coords: Coordinates;
}
export interface Coordinates {
latitude: number;
longitude: number;
}
export enum ConnectionType {
NONE = "No Connection",
WIFI = "Wifi",
CELL_2G = "2G",
CELL_3G = "3G",
CELL_4G = "4G",
UNKNOWN = "Unknown",
}
declare global {
interface Window {
plugins: {
connection: {
type: ConnectionType,
getType: (cb: (type: ConnectionType) => void) => void,
}
geolocation: {
/**
* Callback receives {coords: {latitude: X, longitude: Y}} or null.
* */
getCurrentPosition: (cb: (position: Position | null) => void) => void,
}
camera: {
/**
* Callback receives a base64 encoded JPG or null.
*
* `image.src = 'data:image/jpeg;base64,' + jpgdata;`
* */
pickImage: (maxWidth: number, cb: (jpgdata: string | null) => void) => void,
}
insomnia: {
/**
* If set to true the screen is prevented from turning off.
* You should set this property only if necessary and should be sure to reset it to false when the need no longer exists.
*/
isEnabled: boolean,
/**
* setEnabled allows you to prevent the display from turning off.
*
* Warning! This setting is persisted.
*/
setEnabled: (state: boolean) => void,
},
nativeStorage: {
setItem: (key: string, value: string) => void,
getItem: (key: string, cb: (value: string | null) => void) => void,
removeItem: (key: string) => void,
clear: () => void,
},
keychain: {
setItem: (key: string, value: string) => void,
getItem: (key: string, cb: (value: string | null) => void) => void,
removeItem: (key: string) => void,
clear: () => void,
},
mDNS: {
/** Searches for 6 seconds, then calls `cb` with the results. */
browse: (type: string, cb: ([Service]) => void) => void,
},
utils: {
/** openURL tries to launch the app associated with the URL, does nothing if it fails. */
openURL: (url: string) => void,
}
device: Device,
app: App,
};
}
}