@nitra/zebra 7.1.1 → 7.1.2
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 +9 -7
- package/ios/Sources/ZebraPlugin/Zebra.swift +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @nitra/zebra
|
|
2
2
|
|
|
3
|
-
Capacitor-плагін для друку ZPL на принтерах Zebra з підтримкою веб (Web Serial API), iOS та Android
|
|
3
|
+
Capacitor-плагін для друку ZPL на принтерах Zebra з підтримкою веб (Web Serial API), iOS та Android
|
|
4
4
|
|
|
5
5
|
## Вимоги
|
|
6
6
|
|
|
@@ -16,6 +16,8 @@ npm install @nitra/zebra
|
|
|
16
16
|
npx cap sync
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
Патч-реліз гілки 7.x: за версією — `@nitra/zebra@7.1.2`, або за тегом — `@nitra/zebra@patch` (npm/bun).
|
|
20
|
+
|
|
19
21
|
## API
|
|
20
22
|
|
|
21
23
|
### `print(zpl: string | PrintOptions): Promise<{ sent?: boolean }>`
|
|
@@ -37,10 +39,10 @@ npx cap sync
|
|
|
37
39
|
**Приклад:**
|
|
38
40
|
|
|
39
41
|
```javascript
|
|
40
|
-
import { Zebra } from
|
|
42
|
+
import { Zebra } from "@nitra/zebra";
|
|
41
43
|
|
|
42
|
-
const zpl =
|
|
43
|
-
await Zebra.print(zpl)
|
|
44
|
+
const zpl = "^XA^FO50,50^A0N,28,28^FDHello World^FS^XZ";
|
|
45
|
+
await Zebra.print(zpl);
|
|
44
46
|
```
|
|
45
47
|
|
|
46
48
|
### `setPrinterAddress(options: { address: string, port?: number }): Promise<{ address }>` (Android / iOS)
|
|
@@ -55,8 +57,8 @@ await Zebra.print(zpl)
|
|
|
55
57
|
**Приклад (Android):**
|
|
56
58
|
|
|
57
59
|
```javascript
|
|
58
|
-
await Zebra.setPrinterAddress({ address:
|
|
59
|
-
await Zebra.print(zpl)
|
|
60
|
+
await Zebra.setPrinterAddress({ address: "00:11:22:33:44:55" });
|
|
61
|
+
await Zebra.print(zpl);
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
**Приклад (iOS):** використовуйте `address` з `getPairedDevices()` (серійний номер або ім'я принтера).
|
|
@@ -68,7 +70,7 @@ await Zebra.print(zpl)
|
|
|
68
70
|
**Приклад (Android):**
|
|
69
71
|
|
|
70
72
|
```javascript
|
|
71
|
-
const { devices } = await Zebra.getPairedDevices()
|
|
73
|
+
const { devices } = await Zebra.getPairedDevices();
|
|
72
74
|
// devices: [{ address: "00:11:22:33:44:55", name: "Zebra ZD420" }, ...]
|
|
73
75
|
```
|
|
74
76
|
|
|
@@ -117,7 +117,7 @@ import ExternalAccessory
|
|
|
117
117
|
|
|
118
118
|
/// Після запису всіх байтів дає час на флаш буфера (iOS може не встигнути відправити на пристрій при миттєвому закритті)
|
|
119
119
|
private func flushThenClose() {
|
|
120
|
-
let flushDuration: TimeInterval =
|
|
120
|
+
let flushDuration: TimeInterval = 1.2
|
|
121
121
|
let deadline = Date().addingTimeInterval(flushDuration)
|
|
122
122
|
while Date() < deadline {
|
|
123
123
|
RunLoop.current.run(mode: .default, before: Date().addingTimeInterval(0.05))
|
|
@@ -148,7 +148,7 @@ import ExternalAccessory
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
// 4) Затримка, щоб iOS встиг звільнити EASession до наступного відкриття
|
|
151
|
-
Thread.sleep(forTimeInterval: 0.
|
|
151
|
+
Thread.sleep(forTimeInterval: 0.6)
|
|
152
152
|
if let completion = completion {
|
|
153
153
|
completion(result)
|
|
154
154
|
}
|