-
Notifications
You must be signed in to change notification settings - Fork 84
/
global.d.ts
48 lines (41 loc) · 1.43 KB
/
global.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// This file is only used for type-checking in playground.js
declare class ScratchLinkSafariSocket {
constructor(type: string);
static isSafariHelperCompatible(): boolean;
close(): void;
isOpen(): boolean;
open(): void;
sendMessage(message: object): void;
setHandleMessage(fn: (message: object) => void): void;
setOnClose(fn: (e: Error) => void): void;
setOnError(fn: (e: Error) => void): void;
setOnOpen(fn: () => void): void;
}
declare global {
class JSONRPC {
constructor();
didReceiveCall(method: string, params?: object): void;
sendRemoteNotification(method: string, params?: object): void;
sendRemoteRequest(method: string, params?: object): Promise<any>;
_handleMessage(jsonMessageObject: object): void;
_sendMessage(jsonMessageObject: object): void;
}
class ScratchLinkWebSocket {
constructor(type: string);
close(): void;
isOpen(): boolean;
open(): void;
sendMessage(message: object): void;
setHandleMessage(fn: (message: object) => void): void;
setOnClose(fn: (e: Error) => void): void;
setOnError(fn: (e: Error) => void): void;
setOnOpen(fn: () => void): void;
}
// This isn't proper TS but it seems to work for type checking in playground.js
var Scratch = {
BLE: new ScratchBLE,
BT: new ScratchBT,
ScratchLinkSafariSocket
};
}
export {};