diff options
author | 2023-09-07 04:58:44 -0700 | |
---|---|---|
committer | 2023-09-07 04:58:44 -0700 | |
commit | 57a06745a48093c25d0f4729ccea41a918d6427d (patch) | |
tree | ac2568d5c98918d6364d2a9667c164cd3f3b3867 /src/js/thirdparty/ws.js | |
parent | 4360ec83b4146e15344b304573795f084f86a7c2 (diff) | |
download | bun-57a06745a48093c25d0f4729ccea41a918d6427d.tar.gz bun-57a06745a48093c25d0f4729ccea41a918d6427d.tar.zst bun-57a06745a48093c25d0f4729ccea41a918d6427d.zip |
Progress for Next.js (#4468)
* L
* ipc
* asdfghjkl
* dfghjk
* it works!
* types
* patches for next.js
* sdfghj
* wsdfgn,./
* this
* yolo
* okay loser
* asdfghjk
* add some more APIs
* MESS
* sdfghjkl
* remove native events from streams
* stuff
* remove lazy(primordials) test
* debugging
* okay
* less fake extensions object
* fix `Buffer.toString()` args logic
* fix deserialize
* make tests work
* add test for `Buffer.toString` args
* Update server.zig
* remove test
* update test
* Update spawn-streaming-stdin.test.ts
* fix linux build
* Update fs.test.ts
* cli message improvements
* dfshaj
* Fix fs.watch bug maybe?
* remove
---------
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Diffstat (limited to 'src/js/thirdparty/ws.js')
-rw-r--r-- | src/js/thirdparty/ws.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/js/thirdparty/ws.js b/src/js/thirdparty/ws.js index fe7944971..1d633ddf4 100644 --- a/src/js/thirdparty/ws.js +++ b/src/js/thirdparty/ws.js @@ -712,6 +712,21 @@ class BunWebSocketMocked extends EventEmitter { get onopen() { return this.#onopen; } + + // TODO: implement this more proper + addEventListener(type, listener, options) { + if (type === "message") { + const l = data => listener({ data }); + l.listener = listener; + this.on(type, l); + return; + } + this.on(type, listener); + } + + removeEventListener(type, listener) { + this.off(type, listener); + } } class WebSocketServer extends EventEmitter { |