Skip to content

Commit 78e3270

Browse files
committed
Merge branch 'feature/add-webpack-support'
2 parents 534275d + ab6c20b commit 78e3270

17 files changed

+1599
-25
lines changed

dist/browser.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NostrWSClient } from './core/client';
2+
import type { NostrWSMessage, ConnectionState } from './types/index';
3+
import type { NostrWSClientOptions } from './types/websocket';
4+
export { NostrWSClient };
5+
export type { NostrWSMessage, NostrWSClientOptions, ConnectionState };
6+
declare const _default: {
7+
NostrWSClient: typeof NostrWSClient;
8+
};
9+
export default _default;
10+
//# sourceMappingURL=browser.d.ts.map

dist/browser.d.ts.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/browser.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/browser.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/browser/nostr-websocket-utils.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/browser/nostr-websocket-utils.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/browser/report.html

Lines changed: 39 additions & 0 deletions
Large diffs are not rendered by default.

dist/cjs/browser.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NostrWSClient } from './core/client';
2+
import type { NostrWSMessage, ConnectionState } from './types/index';
3+
import type { NostrWSClientOptions } from './types/websocket';
4+
export { NostrWSClient };
5+
export type { NostrWSMessage, NostrWSClientOptions, ConnectionState };
6+
declare const _default: {
7+
NostrWSClient: typeof NostrWSClient;
8+
};
9+
export default _default;
10+
//# sourceMappingURL=browser.d.ts.map

dist/cjs/browser.d.ts.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/browser.js

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/browser.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/browser.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Nostr WebSocket Utils Browser Demo</title>
7+
</head>
8+
<body>
9+
<h1>Nostr WebSocket Utils Browser Demo</h1>
10+
<div id="status"></div>
11+
<div id="messages"></div>
12+
13+
<script src="../dist/browser/nostr-websocket-utils.min.js"></script>
14+
<script>
15+
// Example usage
16+
const client = new NostrWebSocketUtils.NostrWSClient({
17+
url: 'wss://relay.damus.io',
18+
options: {
19+
autoReconnect: true,
20+
maxRetries: 3
21+
}
22+
});
23+
24+
client.onMessage((message) => {
25+
const messagesDiv = document.getElementById('messages');
26+
messagesDiv.innerHTML += `<p>Received: ${JSON.stringify(message)}</p>`;
27+
});
28+
29+
client.onStatusChange((status) => {
30+
const statusDiv = document.getElementById('status');
31+
statusDiv.innerHTML = `Status: ${status}`;
32+
});
33+
34+
// Connect to the relay
35+
client.connect();
36+
</script>
37+
</body>
38+
</html>

0 commit comments

Comments
 (0)