@capgo/capacitor-flash 7.1.1 → 7.1.3

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/README.md CHANGED
@@ -47,16 +47,20 @@ Works out of the box
47
47
  <docgen-api>
48
48
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
49
49
 
50
+ Capacitor Flash Plugin for controlling device flashlight/torch.
51
+
50
52
  ### isAvailable()
51
53
 
52
54
  ```typescript
53
55
  isAvailable() => Promise<{ value: boolean; }>
54
56
  ```
55
57
 
56
- Checks if flashlight is available
58
+ Checks if flashlight is available on the device.
57
59
 
58
60
  **Returns:** <code>Promise&lt;{ value: boolean; }&gt;</code>
59
61
 
62
+ **Since:** 1.0.0
63
+
60
64
  --------------------
61
65
 
62
66
 
@@ -66,11 +70,13 @@ Checks if flashlight is available
66
70
  switchOn(options: { intensity?: number; }) => Promise<void>
67
71
  ```
68
72
 
69
- Turns the flashlight on
73
+ Turns the flashlight on.
70
74
 
71
- | Param | Type |
72
- | ------------- | ------------------------------------ |
73
- | **`options`** | <code>{ intensity?: number; }</code> |
75
+ | Param | Type | Description |
76
+ | ------------- | ------------------------------------ | -------------------------------------------------- |
77
+ | **`options`** | <code>{ intensity?: number; }</code> | - Optional configuration including light intensity |
78
+
79
+ **Since:** 1.0.0
74
80
 
75
81
  --------------------
76
82
 
@@ -81,7 +87,9 @@ Turns the flashlight on
81
87
  switchOff() => Promise<void>
82
88
  ```
83
89
 
84
- Turns the flashlight off
90
+ Turns the flashlight off.
91
+
92
+ **Since:** 1.0.0
85
93
 
86
94
  --------------------
87
95
 
@@ -92,10 +100,12 @@ Turns the flashlight off
92
100
  isSwitchedOn() => Promise<{ value: boolean; }>
93
101
  ```
94
102
 
95
- Checks if the flashlight is turned on or off
103
+ Checks if the flashlight is currently turned on or off.
96
104
 
97
105
  **Returns:** <code>Promise&lt;{ value: boolean; }&gt;</code>
98
106
 
107
+ **Since:** 1.0.0
108
+
99
109
  --------------------
100
110
 
101
111
 
@@ -105,10 +115,12 @@ Checks if the flashlight is turned on or off
105
115
  toggle() => Promise<{ value: boolean; }>
106
116
  ```
107
117
 
108
- Toggle the flashlight
118
+ Toggle the flashlight on or off.
109
119
 
110
120
  **Returns:** <code>Promise&lt;{ value: boolean; }&gt;</code>
111
121
 
122
+ **Since:** 1.0.0
123
+
112
124
  --------------------
113
125
 
114
126
 
@@ -118,10 +130,12 @@ Toggle the flashlight
118
130
  getPluginVersion() => Promise<{ version: string; }>
119
131
  ```
120
132
 
121
- Get the native Capacitor plugin version
133
+ Get the native Capacitor plugin version.
122
134
 
123
135
  **Returns:** <code>Promise&lt;{ version: string; }&gt;</code>
124
136
 
137
+ **Since:** 1.0.0
138
+
125
139
  --------------------
126
140
 
127
141
  </docgen-api>
@@ -19,7 +19,7 @@ import com.getcapacitor.annotation.PermissionCallback;
19
19
  @CapacitorPlugin(name = "CapacitorFlash", permissions = { @Permission(alias = "camera", strings = { Manifest.permission.CAMERA }) })
20
20
  public class CapacitorFlashPlugin extends Plugin {
21
21
 
22
- private final String PLUGIN_VERSION = "7.1.1";
22
+ private final String PLUGIN_VERSION = "7.1.3";
23
23
 
24
24
  private String cameraId;
25
25
  boolean isFlashStateOn = false;
package/dist/docs.json CHANGED
@@ -2,8 +2,13 @@
2
2
  "api": {
3
3
  "name": "CapacitorFlashPlugin",
4
4
  "slug": "capacitorflashplugin",
5
- "docs": "",
6
- "tags": [],
5
+ "docs": "Capacitor Flash Plugin for controlling device flashlight/torch.",
6
+ "tags": [
7
+ {
8
+ "text": "1.0.0",
9
+ "name": "since"
10
+ }
11
+ ],
7
12
  "methods": [
8
13
  {
9
14
  "name": "isAvailable",
@@ -13,10 +18,22 @@
13
18
  "tags": [
14
19
  {
15
20
  "name": "returns",
16
- "text": "true if flashlight is available and false if not"
21
+ "text": "Promise that resolves with availability status"
22
+ },
23
+ {
24
+ "name": "throws",
25
+ "text": "Error if checking availability fails"
26
+ },
27
+ {
28
+ "name": "since",
29
+ "text": "1.0.0"
30
+ },
31
+ {
32
+ "name": "example",
33
+ "text": "```typescript\nconst { value } = await CapacitorFlash.isAvailable();\nif (value) {\n console.log('Flashlight is available');\n}\n```"
17
34
  }
18
35
  ],
19
- "docs": "Checks if flashlight is available",
36
+ "docs": "Checks if flashlight is available on the device.",
20
37
  "complexTypes": [],
21
38
  "slug": "isavailable"
22
39
  },
@@ -26,22 +43,34 @@
26
43
  "parameters": [
27
44
  {
28
45
  "name": "options",
29
- "docs": "",
46
+ "docs": "- Optional configuration including light intensity",
30
47
  "type": "{ intensity?: number | undefined; }"
31
48
  }
32
49
  ],
33
50
  "returns": "Promise<void>",
34
51
  "tags": [
52
+ {
53
+ "name": "param",
54
+ "text": "options - Optional configuration including light intensity"
55
+ },
35
56
  {
36
57
  "name": "returns",
37
- "text": "an empty Promise"
58
+ "text": "Promise that resolves when flashlight is turned on"
38
59
  },
39
60
  {
40
- "name": "param",
41
- "text": "intensity The intensity of the light between 0.0 and 1.0"
61
+ "name": "throws",
62
+ "text": "Error if flashlight is not available or turning on fails"
63
+ },
64
+ {
65
+ "name": "since",
66
+ "text": "1.0.0"
67
+ },
68
+ {
69
+ "name": "example",
70
+ "text": "```typescript\n// Turn on at full brightness\nawait CapacitorFlash.switchOn({ intensity: 1.0 });\n\n// Turn on at half brightness\nawait CapacitorFlash.switchOn({ intensity: 0.5 });\n```"
42
71
  }
43
72
  ],
44
- "docs": "Turns the flashlight on",
73
+ "docs": "Turns the flashlight on.",
45
74
  "complexTypes": [],
46
75
  "slug": "switchon"
47
76
  },
@@ -52,11 +81,23 @@
52
81
  "returns": "Promise<void>",
53
82
  "tags": [
54
83
  {
55
- "name": "rejects",
56
- "text": "PluginResultError"
84
+ "name": "returns",
85
+ "text": "Promise that resolves when flashlight is turned off"
86
+ },
87
+ {
88
+ "name": "throws",
89
+ "text": "Error if turning off fails"
90
+ },
91
+ {
92
+ "name": "since",
93
+ "text": "1.0.0"
94
+ },
95
+ {
96
+ "name": "example",
97
+ "text": "```typescript\nawait CapacitorFlash.switchOff();\n```"
57
98
  }
58
99
  ],
59
- "docs": "Turns the flashlight off",
100
+ "docs": "Turns the flashlight off.",
60
101
  "complexTypes": [],
61
102
  "slug": "switchoff"
62
103
  },
@@ -68,10 +109,22 @@
68
109
  "tags": [
69
110
  {
70
111
  "name": "returns",
71
- "text": "True of flaslight is turned on and false if not"
112
+ "text": "Promise that resolves with the current flashlight state"
113
+ },
114
+ {
115
+ "name": "throws",
116
+ "text": "Error if checking state fails"
117
+ },
118
+ {
119
+ "name": "since",
120
+ "text": "1.0.0"
121
+ },
122
+ {
123
+ "name": "example",
124
+ "text": "```typescript\nconst { value } = await CapacitorFlash.isSwitchedOn();\nconsole.log('Flashlight is on:', value);\n```"
72
125
  }
73
126
  ],
74
- "docs": "Checks if the flashlight is turned on or off",
127
+ "docs": "Checks if the flashlight is currently turned on or off.",
75
128
  "complexTypes": [],
76
129
  "slug": "isswitchedon"
77
130
  },
@@ -83,10 +136,22 @@
83
136
  "tags": [
84
137
  {
85
138
  "name": "returns",
86
- "text": "True if that worked and false if not"
139
+ "text": "Promise that resolves with the new flashlight state"
140
+ },
141
+ {
142
+ "name": "throws",
143
+ "text": "Error if toggling fails"
144
+ },
145
+ {
146
+ "name": "since",
147
+ "text": "1.0.0"
148
+ },
149
+ {
150
+ "name": "example",
151
+ "text": "```typescript\nconst { value } = await CapacitorFlash.toggle();\nconsole.log('Flashlight toggled, now on:', value);\n```"
87
152
  }
88
153
  ],
89
- "docs": "Toggle the flashlight",
154
+ "docs": "Toggle the flashlight on or off.",
90
155
  "complexTypes": [],
91
156
  "slug": "toggle"
92
157
  },
@@ -98,14 +163,22 @@
98
163
  "tags": [
99
164
  {
100
165
  "name": "returns",
101
- "text": "an Promise with version for this device"
166
+ "text": "Promise that resolves with the plugin version"
102
167
  },
103
168
  {
104
169
  "name": "throws",
105
- "text": "An error if the something went wrong"
170
+ "text": "Error if getting the version fails"
171
+ },
172
+ {
173
+ "name": "since",
174
+ "text": "1.0.0"
175
+ },
176
+ {
177
+ "name": "example",
178
+ "text": "```typescript\nconst { version } = await CapacitorFlash.getPluginVersion();\nconsole.log('Plugin version:', version);\n```"
106
179
  }
107
180
  ],
108
- "docs": "Get the native Capacitor plugin version",
181
+ "docs": "Get the native Capacitor plugin version.",
109
182
  "complexTypes": [],
110
183
  "slug": "getpluginversion"
111
184
  }
@@ -1,43 +1,98 @@
1
+ /**
2
+ * Capacitor Flash Plugin for controlling device flashlight/torch.
3
+ *
4
+ * @since 1.0.0
5
+ */
1
6
  export interface CapacitorFlashPlugin {
2
7
  /**
3
- * Checks if flashlight is available
4
- * @returns {Promise<{ value: boolean }>} true if flashlight is available and false if not
8
+ * Checks if flashlight is available on the device.
9
+ *
10
+ * @returns Promise that resolves with availability status
11
+ * @throws Error if checking availability fails
12
+ * @since 1.0.0
13
+ * @example
14
+ * ```typescript
15
+ * const { value } = await CapacitorFlash.isAvailable();
16
+ * if (value) {
17
+ * console.log('Flashlight is available');
18
+ * }
19
+ * ```
5
20
  */
6
21
  isAvailable(): Promise<{
7
22
  value: boolean;
8
23
  }>;
9
24
  /**
10
- * Turns the flashlight on
11
- * @returns {Promise<void>} an empty Promise
12
- * @param intensity The intensity of the light between 0.0 and 1.0
25
+ * Turns the flashlight on.
26
+ *
27
+ * @param options - Optional configuration including light intensity
28
+ * @returns Promise that resolves when flashlight is turned on
29
+ * @throws Error if flashlight is not available or turning on fails
30
+ * @since 1.0.0
31
+ * @example
32
+ * ```typescript
33
+ * // Turn on at full brightness
34
+ * await CapacitorFlash.switchOn({ intensity: 1.0 });
35
+ *
36
+ * // Turn on at half brightness
37
+ * await CapacitorFlash.switchOn({ intensity: 0.5 });
38
+ * ```
13
39
  */
14
40
  switchOn(options: {
15
41
  intensity?: number;
16
42
  }): Promise<void>;
17
43
  /**
18
- * Turns the flashlight off
19
- * @rejects PluginResultError
44
+ * Turns the flashlight off.
45
+ *
46
+ * @returns Promise that resolves when flashlight is turned off
47
+ * @throws Error if turning off fails
48
+ * @since 1.0.0
49
+ * @example
50
+ * ```typescript
51
+ * await CapacitorFlash.switchOff();
52
+ * ```
20
53
  */
21
54
  switchOff(): Promise<void>;
22
55
  /**
23
- * Checks if the flashlight is turned on or off
24
- * @returns {Promise<{ value: boolean }>} True of flaslight is turned on and false if not
56
+ * Checks if the flashlight is currently turned on or off.
57
+ *
58
+ * @returns Promise that resolves with the current flashlight state
59
+ * @throws Error if checking state fails
60
+ * @since 1.0.0
61
+ * @example
62
+ * ```typescript
63
+ * const { value } = await CapacitorFlash.isSwitchedOn();
64
+ * console.log('Flashlight is on:', value);
65
+ * ```
25
66
  */
26
67
  isSwitchedOn(): Promise<{
27
68
  value: boolean;
28
69
  }>;
29
70
  /**
30
- * Toggle the flashlight
31
- * @returns {Promise<{ value: boolean }>} True if that worked and false if not
71
+ * Toggle the flashlight on or off.
72
+ *
73
+ * @returns Promise that resolves with the new flashlight state
74
+ * @throws Error if toggling fails
75
+ * @since 1.0.0
76
+ * @example
77
+ * ```typescript
78
+ * const { value } = await CapacitorFlash.toggle();
79
+ * console.log('Flashlight toggled, now on:', value);
80
+ * ```
32
81
  */
33
82
  toggle(): Promise<{
34
83
  value: boolean;
35
84
  }>;
36
85
  /**
37
- * Get the native Capacitor plugin version
86
+ * Get the native Capacitor plugin version.
38
87
  *
39
- * @returns {Promise<{ id: string }>} an Promise with version for this device
40
- * @throws An error if the something went wrong
88
+ * @returns Promise that resolves with the plugin version
89
+ * @throws Error if getting the version fails
90
+ * @since 1.0.0
91
+ * @example
92
+ * ```typescript
93
+ * const { version } = await CapacitorFlash.getPluginVersion();
94
+ * console.log('Plugin version:', version);
95
+ * ```
41
96
  */
42
97
  getPluginVersion(): Promise<{
43
98
  version: string;
@@ -7,7 +7,7 @@ import Capacitor
7
7
  */
8
8
  @objc(CapacitorFlashPlugin)
9
9
  public class CapacitorFlashPlugin: CAPPlugin, CAPBridgedPlugin {
10
- private let PLUGIN_VERSION: String = "7.1.1"
10
+ private let PLUGIN_VERSION: String = "7.1.3"
11
11
  public let identifier = "CapacitorFlashPlugin"
12
12
  public let jsName = "CapacitorFlash"
13
13
  public let pluginMethods: [CAPPluginMethod] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-flash",
3
- "version": "7.1.1",
3
+ "version": "7.1.3",
4
4
  "description": "Switch the Flashlight / Torch of your device.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",