@capgo/capacitor-light-sensor 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/docs.json ADDED
@@ -0,0 +1,423 @@
1
+ {
2
+ "api": {
3
+ "name": "LightSensorPlugin",
4
+ "slug": "lightsensorplugin",
5
+ "docs": "Capacitor plugin for accessing the device's ambient light sensor.",
6
+ "tags": [
7
+ {
8
+ "text": "0.0.1",
9
+ "name": "since"
10
+ }
11
+ ],
12
+ "methods": [
13
+ {
14
+ "name": "isAvailable",
15
+ "signature": "() => Promise<IsAvailableResult>",
16
+ "parameters": [],
17
+ "returns": "Promise<IsAvailableResult>",
18
+ "tags": [
19
+ {
20
+ "name": "returns",
21
+ "text": "Promise resolving to availability status"
22
+ },
23
+ {
24
+ "name": "since",
25
+ "text": "0.0.1"
26
+ },
27
+ {
28
+ "name": "example",
29
+ "text": "```typescript\nconst { available } = await LightSensor.isAvailable();\n```"
30
+ }
31
+ ],
32
+ "docs": "Check if the light sensor is available on the current device.\nYou should always check sensor availability before attempting to use it.",
33
+ "complexTypes": [
34
+ "IsAvailableResult"
35
+ ],
36
+ "slug": "isavailable"
37
+ },
38
+ {
39
+ "name": "start",
40
+ "signature": "(options?: StartOptions | undefined) => Promise<void>",
41
+ "parameters": [
42
+ {
43
+ "name": "options",
44
+ "docs": "- Configuration options for the sensor",
45
+ "type": "StartOptions | undefined"
46
+ }
47
+ ],
48
+ "returns": "Promise<void>",
49
+ "tags": [
50
+ {
51
+ "name": "param",
52
+ "text": "options - Configuration options for the sensor"
53
+ },
54
+ {
55
+ "name": "returns",
56
+ "text": "Promise that resolves when the sensor has started"
57
+ },
58
+ {
59
+ "name": "since",
60
+ "text": "0.0.1"
61
+ },
62
+ {
63
+ "name": "example",
64
+ "text": "```typescript\nawait LightSensor.start({ updateInterval: 500 });\n```"
65
+ }
66
+ ],
67
+ "docs": "Start listening to light sensor updates.\nThis will begin sensor measurements at the specified interval.\nUse `addListener` to receive the sensor data.",
68
+ "complexTypes": [
69
+ "StartOptions"
70
+ ],
71
+ "slug": "start"
72
+ },
73
+ {
74
+ "name": "stop",
75
+ "signature": "() => Promise<void>",
76
+ "parameters": [],
77
+ "returns": "Promise<void>",
78
+ "tags": [
79
+ {
80
+ "name": "returns",
81
+ "text": "Promise that resolves when the sensor has stopped"
82
+ },
83
+ {
84
+ "name": "since",
85
+ "text": "0.0.1"
86
+ },
87
+ {
88
+ "name": "example",
89
+ "text": "```typescript\nawait LightSensor.stop();\n```"
90
+ }
91
+ ],
92
+ "docs": "Stop listening to light sensor updates.\nThis will stop the sensor and conserve battery.",
93
+ "complexTypes": [],
94
+ "slug": "stop"
95
+ },
96
+ {
97
+ "name": "addListener",
98
+ "signature": "(eventName: 'lightSensorChange', listenerFunc: LightSensorCallback) => Promise<PluginListenerHandle>",
99
+ "parameters": [
100
+ {
101
+ "name": "eventName",
102
+ "docs": "- Must be 'lightSensorChange'",
103
+ "type": "'lightSensorChange'"
104
+ },
105
+ {
106
+ "name": "listenerFunc",
107
+ "docs": "- Callback function to receive sensor data",
108
+ "type": "LightSensorCallback"
109
+ }
110
+ ],
111
+ "returns": "Promise<PluginListenerHandle>",
112
+ "tags": [
113
+ {
114
+ "name": "param",
115
+ "text": "eventName - Must be 'lightSensorChange'"
116
+ },
117
+ {
118
+ "name": "param",
119
+ "text": "listenerFunc - Callback function to receive sensor data"
120
+ },
121
+ {
122
+ "name": "returns",
123
+ "text": "Promise resolving to a handle for removing the listener"
124
+ },
125
+ {
126
+ "name": "since",
127
+ "text": "0.0.1"
128
+ },
129
+ {
130
+ "name": "example",
131
+ "text": "```typescript\nconst handle = await LightSensor.addListener('lightSensorChange', (data) => {\n console.log('Illuminance:', data.illuminance);\n});\n```"
132
+ }
133
+ ],
134
+ "docs": "Add a listener for light sensor change events.\nThe listener will be called whenever new sensor data is available.",
135
+ "complexTypes": [
136
+ "PluginListenerHandle",
137
+ "LightSensorCallback"
138
+ ],
139
+ "slug": "addlistenerlightsensorchange-"
140
+ },
141
+ {
142
+ "name": "removeAllListeners",
143
+ "signature": "() => Promise<void>",
144
+ "parameters": [],
145
+ "returns": "Promise<void>",
146
+ "tags": [
147
+ {
148
+ "name": "returns",
149
+ "text": "Promise that resolves when all listeners have been removed"
150
+ },
151
+ {
152
+ "name": "since",
153
+ "text": "0.0.1"
154
+ },
155
+ {
156
+ "name": "example",
157
+ "text": "```typescript\nawait LightSensor.removeAllListeners();\n```"
158
+ }
159
+ ],
160
+ "docs": "Remove all listeners for light sensor events.",
161
+ "complexTypes": [],
162
+ "slug": "removealllisteners"
163
+ },
164
+ {
165
+ "name": "checkPermissions",
166
+ "signature": "() => Promise<PermissionStatus>",
167
+ "parameters": [],
168
+ "returns": "Promise<PermissionStatus>",
169
+ "tags": [
170
+ {
171
+ "name": "returns",
172
+ "text": "Promise resolving to the current permission status"
173
+ },
174
+ {
175
+ "name": "since",
176
+ "text": "0.0.1"
177
+ },
178
+ {
179
+ "name": "example",
180
+ "text": "```typescript\nconst status = await LightSensor.checkPermissions();\n```"
181
+ }
182
+ ],
183
+ "docs": "Check the current permission status for high sampling rate sensors.\nOn Android 12+, the HIGH_SAMPLING_RATE_SENSORS permission is required\nfor sensor update intervals below 200ms.",
184
+ "complexTypes": [
185
+ "PermissionStatus"
186
+ ],
187
+ "slug": "checkpermissions"
188
+ },
189
+ {
190
+ "name": "requestPermissions",
191
+ "signature": "() => Promise<PermissionStatus>",
192
+ "parameters": [],
193
+ "returns": "Promise<PermissionStatus>",
194
+ "tags": [
195
+ {
196
+ "name": "returns",
197
+ "text": "Promise resolving to the updated permission status"
198
+ },
199
+ {
200
+ "name": "since",
201
+ "text": "0.0.1"
202
+ },
203
+ {
204
+ "name": "example",
205
+ "text": "```typescript\nconst status = await LightSensor.requestPermissions();\n```"
206
+ }
207
+ ],
208
+ "docs": "Request permission for high sampling rate sensors.\nOn Android 12+, this requests the HIGH_SAMPLING_RATE_SENSORS permission.",
209
+ "complexTypes": [
210
+ "PermissionStatus"
211
+ ],
212
+ "slug": "requestpermissions"
213
+ },
214
+ {
215
+ "name": "getPluginVersion",
216
+ "signature": "() => Promise<VersionResult>",
217
+ "parameters": [],
218
+ "returns": "Promise<VersionResult>",
219
+ "tags": [
220
+ {
221
+ "name": "returns",
222
+ "text": "Promise resolving to the plugin version"
223
+ },
224
+ {
225
+ "name": "since",
226
+ "text": "0.0.1"
227
+ },
228
+ {
229
+ "name": "example",
230
+ "text": "```typescript\nconst { version } = await LightSensor.getPluginVersion();\n```"
231
+ }
232
+ ],
233
+ "docs": "Get the current version of the plugin.",
234
+ "complexTypes": [
235
+ "VersionResult"
236
+ ],
237
+ "slug": "getpluginversion"
238
+ }
239
+ ],
240
+ "properties": []
241
+ },
242
+ "interfaces": [
243
+ {
244
+ "name": "IsAvailableResult",
245
+ "slug": "isavailableresult",
246
+ "docs": "Result indicating whether the sensor is available.",
247
+ "tags": [
248
+ {
249
+ "text": "0.0.1",
250
+ "name": "since"
251
+ }
252
+ ],
253
+ "methods": [],
254
+ "properties": [
255
+ {
256
+ "name": "available",
257
+ "tags": [
258
+ {
259
+ "text": "0.0.1",
260
+ "name": "since"
261
+ }
262
+ ],
263
+ "docs": "Whether the light sensor is available on this device.\nAlways false on iOS as the light sensor API is not available.",
264
+ "complexTypes": [],
265
+ "type": "boolean"
266
+ }
267
+ ]
268
+ },
269
+ {
270
+ "name": "StartOptions",
271
+ "slug": "startoptions",
272
+ "docs": "Options for starting the light sensor listener.",
273
+ "tags": [
274
+ {
275
+ "text": "0.0.1",
276
+ "name": "since"
277
+ }
278
+ ],
279
+ "methods": [],
280
+ "properties": [
281
+ {
282
+ "name": "updateInterval",
283
+ "tags": [
284
+ {
285
+ "text": "200",
286
+ "name": "default"
287
+ },
288
+ {
289
+ "text": "0.0.1",
290
+ "name": "since"
291
+ }
292
+ ],
293
+ "docs": "The desired interval between sensor updates in milliseconds.\nOn Android 12+, there's a minimum interval of 200ms unless the app\nhas the HIGH_SAMPLING_RATE_SENSORS permission.",
294
+ "complexTypes": [],
295
+ "type": "number | undefined"
296
+ }
297
+ ]
298
+ },
299
+ {
300
+ "name": "PluginListenerHandle",
301
+ "slug": "pluginlistenerhandle",
302
+ "docs": "",
303
+ "tags": [],
304
+ "methods": [],
305
+ "properties": [
306
+ {
307
+ "name": "remove",
308
+ "tags": [],
309
+ "docs": "",
310
+ "complexTypes": [],
311
+ "type": "() => Promise<void>"
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "name": "LightSensorMeasurement",
317
+ "slug": "lightsensormeasurement",
318
+ "docs": "A single light sensor measurement.",
319
+ "tags": [
320
+ {
321
+ "text": "0.0.1",
322
+ "name": "since"
323
+ }
324
+ ],
325
+ "methods": [],
326
+ "properties": [
327
+ {
328
+ "name": "illuminance",
329
+ "tags": [
330
+ {
331
+ "text": "0.0.1",
332
+ "name": "since"
333
+ }
334
+ ],
335
+ "docs": "Ambient light level in lux (lx).",
336
+ "complexTypes": [],
337
+ "type": "number"
338
+ },
339
+ {
340
+ "name": "timestamp",
341
+ "tags": [
342
+ {
343
+ "text": "0.0.1",
344
+ "name": "since"
345
+ }
346
+ ],
347
+ "docs": "Timestamp of the measurement in seconds since epoch.",
348
+ "complexTypes": [],
349
+ "type": "number"
350
+ }
351
+ ]
352
+ },
353
+ {
354
+ "name": "PermissionStatus",
355
+ "slug": "permissionstatus",
356
+ "docs": "Result of a permission request or check.",
357
+ "tags": [
358
+ {
359
+ "text": "0.0.1",
360
+ "name": "since"
361
+ }
362
+ ],
363
+ "methods": [],
364
+ "properties": [
365
+ {
366
+ "name": "highSamplingRate",
367
+ "tags": [
368
+ {
369
+ "text": "0.0.1",
370
+ "name": "since"
371
+ }
372
+ ],
373
+ "docs": "Whether the high sampling rate sensor permission is granted.\nOn Android 12+, this permission is required for update intervals below 200ms.",
374
+ "complexTypes": [],
375
+ "type": "'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'"
376
+ }
377
+ ]
378
+ },
379
+ {
380
+ "name": "VersionResult",
381
+ "slug": "versionresult",
382
+ "docs": "Plugin version information.",
383
+ "tags": [
384
+ {
385
+ "text": "0.0.1",
386
+ "name": "since"
387
+ }
388
+ ],
389
+ "methods": [],
390
+ "properties": [
391
+ {
392
+ "name": "version",
393
+ "tags": [
394
+ {
395
+ "text": "0.0.1",
396
+ "name": "since"
397
+ }
398
+ ],
399
+ "docs": "The current version of the plugin.",
400
+ "complexTypes": [],
401
+ "type": "string"
402
+ }
403
+ ]
404
+ }
405
+ ],
406
+ "enums": [],
407
+ "typeAliases": [
408
+ {
409
+ "name": "LightSensorCallback",
410
+ "slug": "lightsensorcallback",
411
+ "docs": "Callback function for light sensor updates.",
412
+ "types": [
413
+ {
414
+ "text": "(measurement: LightSensorMeasurement): void",
415
+ "complexTypes": [
416
+ "LightSensorMeasurement"
417
+ ]
418
+ }
419
+ ]
420
+ }
421
+ ],
422
+ "pluginConfigs": []
423
+ }
@@ -0,0 +1,191 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ /**
3
+ * Result of a permission request or check.
4
+ *
5
+ * @since 0.0.1
6
+ */
7
+ export interface PermissionStatus {
8
+ /**
9
+ * Whether the high sampling rate sensor permission is granted.
10
+ * On Android 12+, this permission is required for update intervals below 200ms.
11
+ *
12
+ * @since 0.0.1
13
+ */
14
+ highSamplingRate: 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';
15
+ }
16
+ /**
17
+ * A single light sensor measurement.
18
+ *
19
+ * @since 0.0.1
20
+ */
21
+ export interface LightSensorMeasurement {
22
+ /**
23
+ * Ambient light level in lux (lx).
24
+ *
25
+ * @since 0.0.1
26
+ */
27
+ illuminance: number;
28
+ /**
29
+ * Timestamp of the measurement in seconds since epoch.
30
+ *
31
+ * @since 0.0.1
32
+ */
33
+ timestamp: number;
34
+ }
35
+ /**
36
+ * Options for starting the light sensor listener.
37
+ *
38
+ * @since 0.0.1
39
+ */
40
+ export interface StartOptions {
41
+ /**
42
+ * The desired interval between sensor updates in milliseconds.
43
+ * On Android 12+, there's a minimum interval of 200ms unless the app
44
+ * has the HIGH_SAMPLING_RATE_SENSORS permission.
45
+ *
46
+ * @default 200
47
+ * @since 0.0.1
48
+ */
49
+ updateInterval?: number;
50
+ }
51
+ /**
52
+ * Result indicating whether the sensor is available.
53
+ *
54
+ * @since 0.0.1
55
+ */
56
+ export interface IsAvailableResult {
57
+ /**
58
+ * Whether the light sensor is available on this device.
59
+ * Always false on iOS as the light sensor API is not available.
60
+ *
61
+ * @since 0.0.1
62
+ */
63
+ available: boolean;
64
+ }
65
+ /**
66
+ * Plugin version information.
67
+ *
68
+ * @since 0.0.1
69
+ */
70
+ export interface VersionResult {
71
+ /**
72
+ * The current version of the plugin.
73
+ *
74
+ * @since 0.0.1
75
+ */
76
+ version: string;
77
+ }
78
+ /**
79
+ * Callback function for light sensor updates.
80
+ *
81
+ * @since 0.0.1
82
+ */
83
+ export type LightSensorCallback = (measurement: LightSensorMeasurement) => void;
84
+ /**
85
+ * Capacitor plugin for accessing the device's ambient light sensor.
86
+ *
87
+ * @since 0.0.1
88
+ */
89
+ export interface LightSensorPlugin {
90
+ /**
91
+ * Check if the light sensor is available on the current device.
92
+ * You should always check sensor availability before attempting to use it.
93
+ *
94
+ * @returns Promise resolving to availability status
95
+ * @since 0.0.1
96
+ * @example
97
+ * ```typescript
98
+ * const { available } = await LightSensor.isAvailable();
99
+ * ```
100
+ */
101
+ isAvailable(): Promise<IsAvailableResult>;
102
+ /**
103
+ * Start listening to light sensor updates.
104
+ * This will begin sensor measurements at the specified interval.
105
+ * Use `addListener` to receive the sensor data.
106
+ *
107
+ * @param options - Configuration options for the sensor
108
+ * @returns Promise that resolves when the sensor has started
109
+ * @since 0.0.1
110
+ * @example
111
+ * ```typescript
112
+ * await LightSensor.start({ updateInterval: 500 });
113
+ * ```
114
+ */
115
+ start(options?: StartOptions): Promise<void>;
116
+ /**
117
+ * Stop listening to light sensor updates.
118
+ * This will stop the sensor and conserve battery.
119
+ *
120
+ * @returns Promise that resolves when the sensor has stopped
121
+ * @since 0.0.1
122
+ * @example
123
+ * ```typescript
124
+ * await LightSensor.stop();
125
+ * ```
126
+ */
127
+ stop(): Promise<void>;
128
+ /**
129
+ * Add a listener for light sensor change events.
130
+ * The listener will be called whenever new sensor data is available.
131
+ *
132
+ * @param eventName - Must be 'lightSensorChange'
133
+ * @param listenerFunc - Callback function to receive sensor data
134
+ * @returns Promise resolving to a handle for removing the listener
135
+ * @since 0.0.1
136
+ * @example
137
+ * ```typescript
138
+ * const handle = await LightSensor.addListener('lightSensorChange', (data) => {
139
+ * console.log('Illuminance:', data.illuminance);
140
+ * });
141
+ * ```
142
+ */
143
+ addListener(eventName: 'lightSensorChange', listenerFunc: LightSensorCallback): Promise<PluginListenerHandle>;
144
+ /**
145
+ * Remove all listeners for light sensor events.
146
+ *
147
+ * @returns Promise that resolves when all listeners have been removed
148
+ * @since 0.0.1
149
+ * @example
150
+ * ```typescript
151
+ * await LightSensor.removeAllListeners();
152
+ * ```
153
+ */
154
+ removeAllListeners(): Promise<void>;
155
+ /**
156
+ * Check the current permission status for high sampling rate sensors.
157
+ * On Android 12+, the HIGH_SAMPLING_RATE_SENSORS permission is required
158
+ * for sensor update intervals below 200ms.
159
+ *
160
+ * @returns Promise resolving to the current permission status
161
+ * @since 0.0.1
162
+ * @example
163
+ * ```typescript
164
+ * const status = await LightSensor.checkPermissions();
165
+ * ```
166
+ */
167
+ checkPermissions(): Promise<PermissionStatus>;
168
+ /**
169
+ * Request permission for high sampling rate sensors.
170
+ * On Android 12+, this requests the HIGH_SAMPLING_RATE_SENSORS permission.
171
+ *
172
+ * @returns Promise resolving to the updated permission status
173
+ * @since 0.0.1
174
+ * @example
175
+ * ```typescript
176
+ * const status = await LightSensor.requestPermissions();
177
+ * ```
178
+ */
179
+ requestPermissions(): Promise<PermissionStatus>;
180
+ /**
181
+ * Get the current version of the plugin.
182
+ *
183
+ * @returns Promise resolving to the plugin version
184
+ * @since 0.0.1
185
+ * @example
186
+ * ```typescript
187
+ * const { version } = await LightSensor.getPluginVersion();
188
+ * ```
189
+ */
190
+ getPluginVersion(): Promise<VersionResult>;
191
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * Result of a permission request or check.\n *\n * @since 0.0.1\n */\nexport interface PermissionStatus {\n /**\n * Whether the high sampling rate sensor permission is granted.\n * On Android 12+, this permission is required for update intervals below 200ms.\n *\n * @since 0.0.1\n */\n highSamplingRate: 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';\n}\n\n/**\n * A single light sensor measurement.\n *\n * @since 0.0.1\n */\nexport interface LightSensorMeasurement {\n /**\n * Ambient light level in lux (lx).\n *\n * @since 0.0.1\n */\n illuminance: number;\n\n /**\n * Timestamp of the measurement in seconds since epoch.\n *\n * @since 0.0.1\n */\n timestamp: number;\n}\n\n/**\n * Options for starting the light sensor listener.\n *\n * @since 0.0.1\n */\nexport interface StartOptions {\n /**\n * The desired interval between sensor updates in milliseconds.\n * On Android 12+, there's a minimum interval of 200ms unless the app\n * has the HIGH_SAMPLING_RATE_SENSORS permission.\n *\n * @default 200\n * @since 0.0.1\n */\n updateInterval?: number;\n}\n\n/**\n * Result indicating whether the sensor is available.\n *\n * @since 0.0.1\n */\nexport interface IsAvailableResult {\n /**\n * Whether the light sensor is available on this device.\n * Always false on iOS as the light sensor API is not available.\n *\n * @since 0.0.1\n */\n available: boolean;\n}\n\n/**\n * Plugin version information.\n *\n * @since 0.0.1\n */\nexport interface VersionResult {\n /**\n * The current version of the plugin.\n *\n * @since 0.0.1\n */\n version: string;\n}\n\n/**\n * Callback function for light sensor updates.\n *\n * @since 0.0.1\n */\nexport type LightSensorCallback = (measurement: LightSensorMeasurement) => void;\n\n/**\n * Capacitor plugin for accessing the device's ambient light sensor.\n *\n * @since 0.0.1\n */\nexport interface LightSensorPlugin {\n /**\n * Check if the light sensor is available on the current device.\n * You should always check sensor availability before attempting to use it.\n *\n * @returns Promise resolving to availability status\n * @since 0.0.1\n * @example\n * ```typescript\n * const { available } = await LightSensor.isAvailable();\n * ```\n */\n isAvailable(): Promise<IsAvailableResult>;\n\n /**\n * Start listening to light sensor updates.\n * This will begin sensor measurements at the specified interval.\n * Use `addListener` to receive the sensor data.\n *\n * @param options - Configuration options for the sensor\n * @returns Promise that resolves when the sensor has started\n * @since 0.0.1\n * @example\n * ```typescript\n * await LightSensor.start({ updateInterval: 500 });\n * ```\n */\n start(options?: StartOptions): Promise<void>;\n\n /**\n * Stop listening to light sensor updates.\n * This will stop the sensor and conserve battery.\n *\n * @returns Promise that resolves when the sensor has stopped\n * @since 0.0.1\n * @example\n * ```typescript\n * await LightSensor.stop();\n * ```\n */\n stop(): Promise<void>;\n\n /**\n * Add a listener for light sensor change events.\n * The listener will be called whenever new sensor data is available.\n *\n * @param eventName - Must be 'lightSensorChange'\n * @param listenerFunc - Callback function to receive sensor data\n * @returns Promise resolving to a handle for removing the listener\n * @since 0.0.1\n * @example\n * ```typescript\n * const handle = await LightSensor.addListener('lightSensorChange', (data) => {\n * console.log('Illuminance:', data.illuminance);\n * });\n * ```\n */\n addListener(\n eventName: 'lightSensorChange',\n listenerFunc: LightSensorCallback,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners for light sensor events.\n *\n * @returns Promise that resolves when all listeners have been removed\n * @since 0.0.1\n * @example\n * ```typescript\n * await LightSensor.removeAllListeners();\n * ```\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Check the current permission status for high sampling rate sensors.\n * On Android 12+, the HIGH_SAMPLING_RATE_SENSORS permission is required\n * for sensor update intervals below 200ms.\n *\n * @returns Promise resolving to the current permission status\n * @since 0.0.1\n * @example\n * ```typescript\n * const status = await LightSensor.checkPermissions();\n * ```\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request permission for high sampling rate sensors.\n * On Android 12+, this requests the HIGH_SAMPLING_RATE_SENSORS permission.\n *\n * @returns Promise resolving to the updated permission status\n * @since 0.0.1\n * @example\n * ```typescript\n * const status = await LightSensor.requestPermissions();\n * ```\n */\n requestPermissions(): Promise<PermissionStatus>;\n\n /**\n * Get the current version of the plugin.\n *\n * @returns Promise resolving to the plugin version\n * @since 0.0.1\n * @example\n * ```typescript\n * const { version } = await LightSensor.getPluginVersion();\n * ```\n */\n getPluginVersion(): Promise<VersionResult>;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { LightSensorPlugin } from './definitions';
2
+ declare const LightSensor: LightSensorPlugin;
3
+ export * from './definitions';
4
+ export { LightSensor };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const LightSensor = registerPlugin('CapgoLightSensor', {
3
+ web: () => import('./web').then((m) => new m.LightSensorWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { LightSensor };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,WAAW,GAAG,cAAc,CAAoB,kBAAkB,EAAE;IACxE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;CAC/D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { LightSensorPlugin } from './definitions';\n\nconst LightSensor = registerPlugin<LightSensorPlugin>('CapgoLightSensor', {\n web: () => import('./web').then((m) => new m.LightSensorWeb()),\n});\n\nexport * from './definitions';\nexport { LightSensor };\n"]}
@@ -0,0 +1,13 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ import { WebPlugin } from '@capacitor/core';
3
+ import type { LightSensorPlugin, IsAvailableResult, StartOptions, PermissionStatus, VersionResult, LightSensorCallback } from './definitions';
4
+ export declare class LightSensorWeb extends WebPlugin implements LightSensorPlugin {
5
+ isAvailable(): Promise<IsAvailableResult>;
6
+ start(_options?: StartOptions): Promise<void>;
7
+ stop(): Promise<void>;
8
+ addListener(_eventName: 'lightSensorChange', _listenerFunc: LightSensorCallback): Promise<PluginListenerHandle>;
9
+ removeAllListeners(): Promise<void>;
10
+ checkPermissions(): Promise<PermissionStatus>;
11
+ requestPermissions(): Promise<PermissionStatus>;
12
+ getPluginVersion(): Promise<VersionResult>;
13
+ }
@@ -0,0 +1,29 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ export class LightSensorWeb extends WebPlugin {
3
+ async isAvailable() {
4
+ // Light sensor is not available on web
5
+ return { available: false };
6
+ }
7
+ async start(_options) {
8
+ throw this.unavailable('Light sensor is not available on web.');
9
+ }
10
+ async stop() {
11
+ // No-op on web
12
+ }
13
+ async addListener(_eventName, _listenerFunc) {
14
+ throw this.unavailable('Light sensor is not available on web.');
15
+ }
16
+ async removeAllListeners() {
17
+ // No-op on web
18
+ }
19
+ async checkPermissions() {
20
+ return { highSamplingRate: 'granted' };
21
+ }
22
+ async requestPermissions() {
23
+ return { highSamplingRate: 'granted' };
24
+ }
25
+ async getPluginVersion() {
26
+ return { version: '8.0.0' };
27
+ }
28
+ }
29
+ //# sourceMappingURL=web.js.map