mirror of
https://github.com/MercuryWorkshop/bare-mux.git
synced 2025-05-14 06:40:02 -04:00
add readystate values to prototype and start minifying bare-mux builds
This commit is contained in:
parent
88ff83bfaf
commit
c299c00a36
3 changed files with 15 additions and 6 deletions
|
@ -26,6 +26,7 @@
|
|||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-inject": "^5.0.5",
|
||||
"@rollup/plugin-replace": "^5.0.5",
|
||||
"rollup": "^4.9.6",
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import inject from '@rollup/plugin-inject';
|
||||
import terser from '@rollup/plugin-terser';
|
||||
import typescript from 'rollup-plugin-typescript2';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const commonPlugins = () => [
|
||||
typescript(),
|
||||
terser(),
|
||||
inject(
|
||||
Object.fromEntries(
|
||||
['fetch', 'Request', 'Response', 'WebSocket', 'XMLHttpRequest', 'SharedWorker', 'localStorage', 'serviceWorker'].map(
|
||||
|
@ -14,6 +16,7 @@ const commonPlugins = () => [
|
|||
)
|
||||
)
|
||||
),
|
||||
|
||||
];
|
||||
|
||||
const configs = [
|
||||
|
|
|
@ -13,11 +13,7 @@ export class BareWebSocket extends EventTarget {
|
|||
onerror = null;
|
||||
onmessage = null;
|
||||
onclose = null;
|
||||
|
||||
CONNECTING = WebSocketFields.CONNECTING;
|
||||
OPEN = WebSocketFields.OPEN;
|
||||
CLOSING = WebSocketFields.CLOSING;
|
||||
CLOSED = WebSocketFields.CLOSED;
|
||||
|
||||
channel: MessageChannel;
|
||||
constructor(
|
||||
remote: string | URL,
|
||||
|
@ -144,4 +140,13 @@ export class BareWebSocket extends EventTarget {
|
|||
get extensions() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
//@ts-expect-error have to do this
|
||||
BareWebSocket.prototype.CONNECTING = WebSocketFields.CONNECTING;
|
||||
//@ts-expect-error have to do this
|
||||
BareWebSocket.prototype.OPEN = WebSocketFields.OPEN;
|
||||
//@ts-expect-error have to do this
|
||||
BareWebSocket.prototype.CLOSING = WebSocketFields.CLOSING;
|
||||
//@ts-expect-error have to do this
|
||||
BareWebSocket.prototype.CLOSED = WebSocketFields.CLOSED;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue