Conversation
TimothyGu
left a comment
There was a problem hiding this comment.
You might find https://github.com/jsdom/webidl2js#writing-implementation-class-files to be helpful when writing the implementation file. Some preliminary comments below.
|
|
||
| const events = ["open", "error", "close"]; | ||
|
|
||
| class WebSocketImpl { |
There was a problem hiding this comment.
This should extends EventTargetImpl, after importing EventTargetImpl from require('../events/EventTarget-impl').implementation.
| const events = ["open", "error", "close"]; | ||
|
|
||
| class WebSocketImpl { | ||
| constructor() { |
There was a problem hiding this comment.
This will have to be constructor(args, privateData), and immediately after the declaration super(args, privateData) to initialize EventTarget.
| // https://html.spec.whatwg.org/multipage/web-sockets.html#the-websocket-interface | ||
|
|
||
| enum BinaryType { "blob", "arraybuffer" }; | ||
| [Constructor(USVString url, optional (DOMString or sequence<DOMString>) protocols = []), Exposed=(Window,Worker)] |
There was a problem hiding this comment.
It looks like this is going to have to contain WebIDL2JSFactory attribute as well, since EventTarget won't function w/o a ownerDocument, which is per-window.
Basically, instead of having a shared WebSocket interface in living/index.js, you would want to create a new interface in the Window constructor. Check out f77cc1e and https://github.com/jsdom/webidl2js#webidl2jsfactory.
|
This is superseded by #2088. |
Fixes #1195
Opening this PR to track progress.