Run npm install (#43)
All checks were successful
Lint / pre-commit Linting (push) Successful in 1m18s

Reviewed-on: #43
This commit was merged in pull request #43.
This commit is contained in:
2025-12-16 01:07:55 +01:00
parent 9510650dd1
commit 74d74b73ad
614 changed files with 6056 additions and 159231 deletions

78
node_modules/ws/lib/event-target.js generated vendored
View File

@@ -10,9 +10,10 @@ class Event {
* Create a new `Event`.
*
* @param {String} type The name of the event
* @param {Object} target A reference to the target to which the event was dispatched
* @param {Object} target A reference to the target to which the event was
* dispatched
*/
constructor (type, target) {
constructor(type, target) {
this.target = target;
this.type = type;
}
@@ -29,9 +30,10 @@ class MessageEvent extends Event {
* Create a new `MessageEvent`.
*
* @param {(String|Buffer|ArrayBuffer|Buffer[])} data The received data
* @param {WebSocket} target A reference to the target to which the event was dispatched
* @param {WebSocket} target A reference to the target to which the event was
* dispatched
*/
constructor (data, target) {
constructor(data, target) {
super('message', target);
this.data = data;
@@ -48,11 +50,14 @@ class CloseEvent extends Event {
/**
* Create a new `CloseEvent`.
*
* @param {Number} code The status code explaining why the connection is being closed
* @param {String} reason A human-readable string explaining why the connection is closing
* @param {WebSocket} target A reference to the target to which the event was dispatched
* @param {Number} code The status code explaining why the connection is being
* closed
* @param {String} reason A human-readable string explaining why the
* connection is closing
* @param {WebSocket} target A reference to the target to which the event was
* dispatched
*/
constructor (code, reason, target) {
constructor(code, reason, target) {
super('close', target);
this.wasClean = target._closeFrameReceived && target._closeFrameSent;
@@ -71,9 +76,10 @@ class OpenEvent extends Event {
/**
* Create a new `OpenEvent`.
*
* @param {WebSocket} target A reference to the target to which the event was dispatched
* @param {WebSocket} target A reference to the target to which the event was
* dispatched
*/
constructor (target) {
constructor(target) {
super('open', target);
}
}
@@ -89,9 +95,10 @@ class ErrorEvent extends Event {
* Create a new `ErrorEvent`.
*
* @param {Object} error The error that generated this event
* @param {WebSocket} target A reference to the target to which the event was dispatched
* @param {WebSocket} target A reference to the target to which the event was
* dispatched
*/
constructor (error, target) {
constructor(error, target) {
super('error', target);
this.message = error.message;
@@ -109,59 +116,66 @@ const EventTarget = {
/**
* Register an event listener.
*
* @param {String} method A string representing the event type to listen for
* @param {String} type A string representing the event type to listen for
* @param {Function} listener The listener to add
* @param {Object} [options] An options object specifies characteristics about
* the event listener
* @param {Boolean} [options.once=false] A `Boolean`` indicating that the
* listener should be invoked at most once after being added. If `true`,
* the listener would be automatically removed when invoked.
* @public
*/
addEventListener (method, listener) {
addEventListener(type, listener, options) {
if (typeof listener !== 'function') return;
function onMessage (data) {
function onMessage(data) {
listener.call(this, new MessageEvent(data, this));
}
function onClose (code, message) {
function onClose(code, message) {
listener.call(this, new CloseEvent(code, message, this));
}
function onError (error) {
function onError(error) {
listener.call(this, new ErrorEvent(error, this));
}
function onOpen () {
function onOpen() {
listener.call(this, new OpenEvent(this));
}
if (method === 'message') {
const method = options && options.once ? 'once' : 'on';
if (type === 'message') {
onMessage._listener = listener;
this.on(method, onMessage);
} else if (method === 'close') {
this[method](type, onMessage);
} else if (type === 'close') {
onClose._listener = listener;
this.on(method, onClose);
} else if (method === 'error') {
this[method](type, onClose);
} else if (type === 'error') {
onError._listener = listener;
this.on(method, onError);
} else if (method === 'open') {
this[method](type, onError);
} else if (type === 'open') {
onOpen._listener = listener;
this.on(method, onOpen);
this[method](type, onOpen);
} else {
this.on(method, listener);
this[method](type, listener);
}
},
/**
* Remove an event listener.
*
* @param {String} method A string representing the event type to remove
* @param {String} type A string representing the event type to remove
* @param {Function} listener The listener to remove
* @public
*/
removeEventListener (method, listener) {
const listeners = this.listeners(method);
removeEventListener(type, listener) {
const listeners = this.listeners(type);
for (var i = 0; i < listeners.length; i++) {
for (let i = 0; i < listeners.length; i++) {
if (listeners[i] === listener || listeners[i]._listener === listener) {
this.removeListener(method, listeners[i]);
this.removeListener(type, listeners[i]);
}
}
}