Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [2.18.2-beta.0](https://github.com/mastergo-design/plugin-typings/compare/v2.18.1...v2.18.2-beta.0) (2026-06-11)


### Features

* **types:** add WebSocket API type definitions ([9f7ee75](https://github.com/mastergo-design/plugin-typings/commit/9f7ee7543ef4959620cb2f36f39f6ab0df59b8fe))



## [2.18.1](https://github.com/mastergo-design/plugin-typings/compare/v2.18.0...v2.18.1) (2026-06-05)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mastergo/plugin-typings",
"version": "2.18.1",
"version": "2.18.2-beta.0",
"description": "MasterGo插件API声明文件",
"type": "module",
"main": "",
Expand Down
25 changes: 25 additions & 0 deletions plugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ declare global {

readonly clientStorage: ClientStorageAPI

readonly WebSocket: WebSocketAPI

readonly currentUser: User | null

readonly viewport: ViewportAPI
Expand Down Expand Up @@ -568,6 +570,29 @@ declare global {
keysAsync(): Promise<string[]>
}

interface WebSocketHandle {
readonly readyState: number
readonly url: string
readonly protocol: string

onopen: ((self: WebSocketHandle, event: { type: string }) => void) | undefined
onmessage: ((self: WebSocketHandle, data: any) => void) | undefined
onclose: ((self: WebSocketHandle, event: { code: number; reason: string; wasClean: boolean }) => void) | undefined
onerror: ((self: WebSocketHandle, event: { type: string }) => void) | undefined

send(data: any): void
close(code?: number, reason?: string): void
}

interface WebSocketAPI {
CONNECTING: 0
OPEN: 1
CLOSING: 2
CLOSED: 3

connect(url: string, protocols?: string | string[]): WebSocketHandle
}

type ShowUIOptions = {
width?: number
height?: number
Expand Down