@laplace.live/event-bridge-sdk 0.0.4 → 0.0.6
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 +2 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# LAPLACE Event Bridge
|
|
1
|
+
# LAPLACE Event Bridge SDK
|
|
2
2
|
|
|
3
3
|
A TypeScript SDK for connecting to the LAPLACE Event Bridge server. This SDK allows clients to receive and send events from/to the LAPLACE Event Bridge.
|
|
4
4
|
|
|
@@ -21,7 +21,6 @@ bun add @laplace.live/event-bridge-sdk
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
import { LaplaceEventBridgeClient } from '@laplace.live/event-bridge-sdk'
|
|
24
|
-
import type { Message, System } from '@laplace.live/event-types'
|
|
25
24
|
|
|
26
25
|
// Create a new client
|
|
27
26
|
const client = new LaplaceEventBridgeClient({
|
|
@@ -33,15 +32,11 @@ const client = new LaplaceEventBridgeClient({
|
|
|
33
32
|
// Connect to the bridge
|
|
34
33
|
await client.connect()
|
|
35
34
|
|
|
36
|
-
// Event types are automatically inferred from the event type string!
|
|
37
35
|
client.on('message', event => {
|
|
38
|
-
// TypeScript knows 'event' is of type 'Message' here
|
|
39
36
|
console.log(`${event.username}: ${event.message}`)
|
|
40
37
|
})
|
|
41
38
|
|
|
42
|
-
// No need for explicit type parameters
|
|
43
39
|
client.on('system', event => {
|
|
44
|
-
// TypeScript knows 'event' is of type 'System' here
|
|
45
40
|
console.log(`System: ${event.message}`)
|
|
46
41
|
})
|
|
47
42
|
|
|
@@ -104,7 +99,7 @@ client.on('gift', event => {
|
|
|
104
99
|
|
|
105
100
|
## Event Types
|
|
106
101
|
|
|
107
|
-
Event types are imported from `@laplace.live/event-types` package. See the [documentation](https://chat.laplace.live/event-types
|
|
102
|
+
Event types are imported from `@laplace.live/event-types` package. See the [documentation](https://chat.laplace.live/event-types) for available event types.
|
|
108
103
|
|
|
109
104
|
## License
|
|
110
105
|
|