fix useWebSocketImplementation so it works with pool on nodejs esm.

This commit is contained in:
fiatjaf
2024-05-29 13:37:45 -03:00
parent 4f1dc9ef1c
commit 87a91c2daf
8 changed files with 60 additions and 23 deletions

14
pool.ts
View File

@@ -1,9 +1,21 @@
/* global WebSocket */
import { verifyEvent } from './pure.ts'
import { AbstractSimplePool } from './abstract-pool.ts'
var _WebSocket: typeof WebSocket
try {
_WebSocket = WebSocket
} catch {}
export function useWebSocketImplementation(websocketImplementation: any) {
_WebSocket = websocketImplementation
}
export class SimplePool extends AbstractSimplePool {
constructor() {
super({ verifyEvent })
super({ verifyEvent, websocketImplementation: _WebSocket })
}
}