@satorijs/protocol
Advanced tools
Comparing version 1.3.0-alpha.0 to 1.3.0
@@ -224,1 +224,45 @@ import Element from '@satorijs/element'; | ||
} | ||
export namespace WebSocket { | ||
/** The connection is not yet open. */ | ||
const CONNECTING = 0; | ||
/** The connection is open and ready to communicate. */ | ||
const OPEN = 1; | ||
/** The connection is in the process of closing. */ | ||
const CLOSING = 2; | ||
/** The connection is closed. */ | ||
const CLOSED = 3; | ||
type ReadyState = typeof CONNECTING | typeof OPEN | typeof CLOSING | typeof CLOSED; | ||
interface EventMap { | ||
open: Event; | ||
error: ErrorEvent; | ||
message: MessageEvent; | ||
close: CloseEvent; | ||
} | ||
interface EventListener { | ||
(event: Event): void; | ||
} | ||
interface Event { | ||
type: string; | ||
target: WebSocket; | ||
} | ||
interface CloseEvent extends Event { | ||
code: number; | ||
reason: string; | ||
} | ||
interface MessageEvent extends Event { | ||
data: string; | ||
} | ||
interface ErrorEvent extends Event { | ||
message?: string; | ||
} | ||
} | ||
export interface WebSocket { | ||
readonly url?: string; | ||
readonly protocol?: string; | ||
readonly readyState?: number; | ||
close(code?: number, reason?: string): void; | ||
send(data: string): void; | ||
dispatchEvent?(event: any): boolean; | ||
addEventListener<K extends keyof WebSocket.EventMap>(type: K, listener: (event: WebSocket.EventMap[K]) => void): void; | ||
removeEventListener<K extends keyof WebSocket.EventMap>(type: K, listener: (event: WebSocket.EventMap[K]) => void): void; | ||
} |
{ | ||
"name": "@satorijs/protocol", | ||
"description": "Protocol types for Satori protocol", | ||
"version": "1.3.0-alpha.0", | ||
"version": "1.3.0", | ||
"type": "module", | ||
@@ -15,2 +15,3 @@ "main": "lib/index.cjs", | ||
}, | ||
"./src/*": "./src/*", | ||
"./package.json": "./package.json" | ||
@@ -41,5 +42,5 @@ }, | ||
"dependencies": { | ||
"@satorijs/element": "^3.1.4", | ||
"@satorijs/element": "^3.1.6", | ||
"cosmokit": "^1.5.2" | ||
} | ||
} |
@@ -336,1 +336,58 @@ import Element from '@satorijs/element' | ||
} | ||
export namespace WebSocket { | ||
/** The connection is not yet open. */ | ||
export const CONNECTING = 0 | ||
/** The connection is open and ready to communicate. */ | ||
export const OPEN = 1 | ||
/** The connection is in the process of closing. */ | ||
export const CLOSING = 2 | ||
/** The connection is closed. */ | ||
export const CLOSED = 3 | ||
export type ReadyState = | ||
| typeof CONNECTING | ||
| typeof OPEN | ||
| typeof CLOSING | ||
| typeof CLOSED | ||
export interface EventMap { | ||
open: Event | ||
error: ErrorEvent | ||
message: MessageEvent | ||
close: CloseEvent | ||
} | ||
export interface EventListener { | ||
(event: Event): void | ||
} | ||
export interface Event { | ||
type: string | ||
target: WebSocket | ||
} | ||
export interface CloseEvent extends Event { | ||
code: number | ||
reason: string | ||
} | ||
export interface MessageEvent extends Event { | ||
data: string | ||
} | ||
export interface ErrorEvent extends Event { | ||
message?: string | ||
} | ||
} | ||
export interface WebSocket { | ||
readonly url?: string | ||
readonly protocol?: string | ||
readonly readyState?: number | ||
close(code?: number, reason?: string): void | ||
send(data: string): void | ||
dispatchEvent?(event: any): boolean | ||
addEventListener<K extends keyof WebSocket.EventMap>(type: K, listener: (event: WebSocket.EventMap[K]) => void): void | ||
removeEventListener<K extends keyof WebSocket.EventMap>(type: K, listener: (event: WebSocket.EventMap[K]) => void): void | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
36502
811
0
Updated@satorijs/element@^3.1.6