@mastergo/plugin-typings 2.18.1 → 2.18.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +25 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1339,6 +1339,8 @@ declare global {
1339
1339
 
1340
1340
  readonly clientStorage: ClientStorageAPI
1341
1341
 
1342
+ readonly WebSocket: WebSocketAPI
1343
+
1342
1344
  readonly currentUser: User | null
1343
1345
 
1344
1346
  readonly viewport: ViewportAPI
@@ -1592,6 +1594,29 @@ declare global {
1592
1594
  keysAsync(): Promise<string[]>
1593
1595
  }
1594
1596
 
1597
+ interface WebSocketHandle {
1598
+ readonly readyState: number
1599
+ readonly url: string
1600
+ readonly protocol: string
1601
+
1602
+ onopen: ((self: WebSocketHandle, event: { type: string }) => void) | undefined
1603
+ onmessage: ((self: WebSocketHandle, data: any) => void) | undefined
1604
+ onclose: ((self: WebSocketHandle, event: { code: number; reason: string; wasClean: boolean }) => void) | undefined
1605
+ onerror: ((self: WebSocketHandle, event: { type: string }) => void) | undefined
1606
+
1607
+ send(data: any): void
1608
+ close(code?: number, reason?: string): void
1609
+ }
1610
+
1611
+ interface WebSocketAPI {
1612
+ CONNECTING: 0
1613
+ OPEN: 1
1614
+ CLOSING: 2
1615
+ CLOSED: 3
1616
+
1617
+ connect(url: string, protocols?: string | string[]): WebSocketHandle
1618
+ }
1619
+
1595
1620
  type ShowUIOptions = {
1596
1621
  width?: number
1597
1622
  height?: number
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastergo/plugin-typings",
3
- "version": "2.18.1",
3
+ "version": "2.18.2-beta.0",
4
4
  "description": "MasterGo插件API声明文件",
5
5
  "type": "module",
6
6
  "main": "",