Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ jobs:
- name: Run linter
run: npm run lint

- name: Run type check
run: npm run typecheck

- name: Run unit tests
run: npm test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
dist
node_modules
.vscode
CLAUDE.md
4 changes: 0 additions & 4 deletions .npmignore

This file was deleted.

4 changes: 0 additions & 4 deletions .vscode/settings.json

This file was deleted.

9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ Establishes a connection to a MessengerServer.

- `Error` if endpoint doesn't have `postMessage()` method
- `Error` if connection times out
- `Error` if `disconnect()` is called before the connection is established

**Examples:**

Expand All @@ -281,7 +282,7 @@ await messenger.connect('main', self);

#### `disconnect()`

Disconnects from the server, clears all subscriptions, and cleans up resources.
Disconnects from the server, clears all subscriptions, and cleans up resources. A pending `connect()` or `req()` is rejected with an `Error`.

```typescript
messenger.disconnect();
Expand All @@ -294,7 +295,7 @@ Sends a one-way message to a topic. Does not wait for a response.
**Parameters:**

- `topic` (**string**): Topic name
- `data` (**unknown**): Data to send
- `data` (**unknown**, optional): Data to send

**Throws:** `Error` if not connected

Expand Down Expand Up @@ -323,6 +324,8 @@ Sends a request to a topic and waits for a response.
- `Error` if not connected
- `Error` if request times out
- `Error` if the topic is not bound on the server
- `Error` if the server's handler throws or returns a rejected Promise
- `Error` if `disconnect()` is called before the response arrives

**Examples:**

Expand Down Expand Up @@ -378,7 +381,7 @@ messenger.subscribe<Notification>('notifications', (data) => {

#### `unsubscribe(topic, listener)`

Unsubscribes from a topic.
Unsubscribes from a topic. Once a topic has no listeners left, the server stops publishing it to this client.

**Parameters:**

Expand Down
Loading
Loading