@simplysm/capacitor-plugin-broadcast 13.0.78 → 13.0.80

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.
Files changed (2) hide show
  1. package/package.json +4 -3
  2. package/README.md +0 -153
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/capacitor-plugin-broadcast",
3
- "version": "13.0.78",
3
+ "version": "13.0.80",
4
4
  "description": "Simplysm Package - Capacitor Broadcast Plugin",
5
5
  "author": "simplysm",
6
6
  "license": "MIT",
@@ -15,10 +15,11 @@
15
15
  "files": [
16
16
  "dist",
17
17
  "src",
18
- "android"
18
+ "android",
19
+ "docs"
19
20
  ],
20
21
  "devDependencies": {
21
- "@capacitor/core": "^7.5.0"
22
+ "@capacitor/core": "^7.6.0"
22
23
  },
23
24
  "peerDependencies": {
24
25
  "@capacitor/core": "^7.4.4"
package/README.md DELETED
@@ -1,153 +0,0 @@
1
- # @simplysm/capacitor-plugin-broadcast
2
-
3
- Simplysm Package - Capacitor Broadcast Plugin
4
-
5
- A Capacitor plugin for sending and receiving Android broadcasts. Designed for industrial device integration (barcode scanners, PDAs, etc.).
6
-
7
- ## Installation
8
-
9
- ```bash
10
- pnpm add @simplysm/capacitor-plugin-broadcast
11
- ```
12
-
13
- ## Main Modules
14
-
15
- ### Broadcast
16
-
17
- A static class for sending and receiving Android broadcasts.
18
-
19
- #### `Broadcast.subscribe(filters, callback)`
20
-
21
- Registers a broadcast receiver for the given action filters. Returns an async unsubscribe function.
22
-
23
- ```ts
24
- import { Broadcast } from "@simplysm/capacitor-plugin-broadcast";
25
-
26
- const unsub = await Broadcast.subscribe(
27
- ["com.symbol.datawedge.api.RESULT_ACTION"],
28
- (result) => {
29
- console.log(result.action);
30
- console.log(result.extras);
31
- }
32
- );
33
-
34
- // Unsubscribe when done
35
- await unsub();
36
- ```
37
-
38
- | Parameter | Type | Description |
39
- | ---------- | -------------------------------------- | ----------------------------------------------- |
40
- | `filters` | `string[]` | List of broadcast action strings to listen for |
41
- | `callback` | `(result: BroadcastResult) => void` | Called each time a matching broadcast is received |
42
-
43
- Returns: `Promise<() => Promise<void>>` — an async function that unsubscribes the receiver.
44
-
45
- #### `Broadcast.unsubscribeAll()`
46
-
47
- Unsubscribes all currently registered broadcast receivers.
48
-
49
- ```ts
50
- import { Broadcast } from "@simplysm/capacitor-plugin-broadcast";
51
-
52
- await Broadcast.unsubscribeAll();
53
- ```
54
-
55
- #### `Broadcast.send(options)`
56
-
57
- Sends an Android broadcast intent.
58
-
59
- ```ts
60
- import { Broadcast } from "@simplysm/capacitor-plugin-broadcast";
61
-
62
- await Broadcast.send({
63
- action: "com.symbol.datawedge.api.ACTION",
64
- extras: {
65
- "com.symbol.datawedge.api.SOFT_SCAN_TRIGGER": "TOGGLE_SCANNING",
66
- },
67
- });
68
- ```
69
-
70
- | Parameter | Type | Description |
71
- | ---------------- | ------------------------------------- | ------------------------------------ |
72
- | `options.action` | `string` | The broadcast action string to send |
73
- | `options.extras` | `Record<string, unknown>` (optional) | Extra data to include in the intent |
74
-
75
- #### `Broadcast.getLaunchIntent()`
76
-
77
- Returns the intent that launched the app, if available.
78
-
79
- ```ts
80
- import { Broadcast } from "@simplysm/capacitor-plugin-broadcast";
81
-
82
- const intent = await Broadcast.getLaunchIntent();
83
- console.log(intent.action);
84
- console.log(intent.extras);
85
- ```
86
-
87
- Returns: `Promise<BroadcastResult>`
88
-
89
- #### `Broadcast.addListener(eventName, callback)`
90
-
91
- Registers a listener for new intents received while the app is running. Returns a `PluginListenerHandle` which can be released by calling `.remove()`.
92
-
93
- ```ts
94
- import { Broadcast } from "@simplysm/capacitor-plugin-broadcast";
95
-
96
- const handle = await Broadcast.addListener("newIntent", (result) => {
97
- console.log(result.action);
98
- console.log(result.extras);
99
- });
100
-
101
- // Remove listener when done
102
- await handle.remove();
103
- ```
104
-
105
- | Parameter | Type | Description |
106
- | ----------- | -------------------------------------- | ------------------------------------ |
107
- | `eventName` | `"newIntent"` | The event to listen for |
108
- | `callback` | `(result: BroadcastResult) => void` | Called when a new intent is received |
109
-
110
- Returns: `Promise<PluginListenerHandle>`
111
-
112
- #### `Broadcast.removeAllListeners()`
113
-
114
- Removes all registered event listeners.
115
-
116
- ```ts
117
- import { Broadcast } from "@simplysm/capacitor-plugin-broadcast";
118
-
119
- await Broadcast.removeAllListeners();
120
- ```
121
-
122
- ## Types
123
-
124
- ### `BroadcastResult`
125
-
126
- Represents the data received from a broadcast intent.
127
-
128
- ```ts
129
- import type { BroadcastResult } from "@simplysm/capacitor-plugin-broadcast";
130
- ```
131
-
132
- | Field | Type | Description |
133
- | -------- | ------------------------------------- | --------------------- |
134
- | `action` | `string` (optional) | The broadcast action |
135
- | `extras` | `Record<string, unknown>` (optional) | Extra intent data |
136
-
137
- ### `BroadcastPlugin`
138
-
139
- The low-level Capacitor plugin interface. Use the `Broadcast` class instead of this interface directly.
140
-
141
- ```ts
142
- import type { BroadcastPlugin } from "@simplysm/capacitor-plugin-broadcast";
143
- ```
144
-
145
- | Method | Signature | Description |
146
- | -------------------- | ---------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
147
- | `subscribe` | `(options: { filters: string[] }, callback: (result: BroadcastResult) => void) => Promise<{ id: string }>` | Register a broadcast receiver |
148
- | `unsubscribe` | `(options: { id: string }) => Promise<void>` | Unsubscribe a specific receiver by ID |
149
- | `unsubscribeAll` | `() => Promise<void>` | Unsubscribe all receivers |
150
- | `send` | `(options: { action: string; extras?: Record<string, unknown> }) => Promise<void>` | Send a broadcast |
151
- | `getLaunchIntent` | `() => Promise<BroadcastResult>` | Get the launch intent |
152
- | `addListener` | `(eventName: "newIntent", listenerFunc: (data: BroadcastResult) => void) => Promise<PluginListenerHandle>` | Listen for new intents while app is running |
153
- | `removeAllListeners` | `() => Promise<void>` | Remove all event listeners |