@zendrex/buttplug.js 0.1.0 → 0.1.1
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 +29 -4
- package/dist/index.cjs +261 -328
- package/dist/index.d.cts +41 -384
- package/dist/index.d.ts +41 -384
- package/dist/index.js +260 -291
- package/package.json +40 -5
package/README.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
# @zendrex/buttplug.js
|
|
2
2
|
|
|
3
|
-
TypeScript client for the [Buttplug](https://buttplug.io) protocol v4. Connect to [Intiface Central](https://intiface.com/central/), discover devices, and control them with a type-safe API.
|
|
3
|
+
Modern TypeScript client for the [Buttplug](https://buttplug.io) intimate hardware protocol v4. Connect to [Intiface Central](https://intiface.com/central/), discover devices, and control them with a type-safe API.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- Buttplug protocol v4 over WebSocket
|
|
7
|
+
- Full Buttplug protocol v4 implementation over WebSocket
|
|
8
8
|
- 10 output types — vibration, rotation, position, oscillation, constriction, temperature, LED, spray, and more
|
|
9
9
|
- 5 sensor types — battery, RSSI, pressure, button, position (one-shot reads and subscriptions)
|
|
10
10
|
- Pattern engine with 7 built-in presets, custom keyframes, and easing curves
|
|
11
11
|
- Auto-reconnect with exponential backoff
|
|
12
|
-
- Zod-validated protocol messages
|
|
12
|
+
- Zod-validated protocol messages with full type inference
|
|
13
|
+
- ESM and CJS dual-package output with `.d.ts` types
|
|
13
14
|
- Zero config — point at Intiface Central and go
|
|
14
15
|
|
|
15
16
|
## Prerequisites
|
|
@@ -58,6 +59,7 @@ await client.connect();
|
|
|
58
59
|
await client.startScanning();
|
|
59
60
|
await client.stopAll();
|
|
60
61
|
await client.disconnect();
|
|
62
|
+
client.dispose(); // cleanup listeners and internal state
|
|
61
63
|
|
|
62
64
|
client.connected; // boolean
|
|
63
65
|
client.devices; // Device[]
|
|
@@ -120,7 +122,17 @@ engine.stopAll();
|
|
|
120
122
|
engine.dispose();
|
|
121
123
|
```
|
|
122
124
|
|
|
123
|
-
**Presets:**
|
|
125
|
+
**Presets:**
|
|
126
|
+
|
|
127
|
+
| Preset | Description | Loops |
|
|
128
|
+
|--------|-------------|-------|
|
|
129
|
+
| `pulse` | Square wave on/off | yes |
|
|
130
|
+
| `wave` | Smooth sine wave oscillation | yes |
|
|
131
|
+
| `ramp_up` | Gradual increase to maximum | no |
|
|
132
|
+
| `ramp_down` | Gradual decrease to zero | no |
|
|
133
|
+
| `heartbeat` | Ba-bump heartbeat rhythm | yes |
|
|
134
|
+
| `surge` | Build to peak then release | no |
|
|
135
|
+
| `stroke` | Full-range position strokes | yes |
|
|
124
136
|
|
|
125
137
|
**Easings:** `linear`, `easeIn`, `easeOut`, `easeInOut`, `step`
|
|
126
138
|
|
|
@@ -149,6 +161,19 @@ const client = new ButtplugClient("ws://127.0.0.1:12345", {
|
|
|
149
161
|
|
|
150
162
|
On reconnection, the client re-handshakes, reconciles the device list, and emits `reconnected`. The pattern engine automatically stops patterns for removed devices.
|
|
151
163
|
|
|
164
|
+
### Cleanup
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
// Graceful shutdown
|
|
168
|
+
await client.disconnect();
|
|
169
|
+
|
|
170
|
+
// Release all internal state and event listeners
|
|
171
|
+
client.dispose();
|
|
172
|
+
|
|
173
|
+
// Pattern engine cleanup
|
|
174
|
+
engine.dispose();
|
|
175
|
+
```
|
|
176
|
+
|
|
152
177
|
## Documentation
|
|
153
178
|
|
|
154
179
|
Full API reference and guides are available in the [`docs/`](./docs) directory. To run locally:
|