@turbowarp/types 0.0.5 → 0.0.6
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.
- package/README.md +1 -3
- package/package.json +1 -1
- package/tests/test-jszip.ts +16 -0
- package/tests/test-scratch-vm-extension.js +70 -1
- package/tests/test-scratch-vm.ts +4 -0
- package/types/jszip.d.ts +24 -0
- package/types/scratch-vm-extension.d.ts +185 -67
- package/types/scratch-vm.d.ts +70 -2
package/README.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Scratch doesn't provide type definitions for their libraries, so we wrote our own.
|
|
4
4
|
|
|
5
|
-
This
|
|
6
|
-
|
|
7
|
-
Despite being in the TurboWarp organization, this project is currently focused only on the vanilla (LLK) Scratch runtime and editor. Additional types for TurboWarp may be added later.
|
|
5
|
+
This repository only contains types for the vanilla (LLK) Scratch runtime and editor. For the additional types in the TurboWarp runtimes, see [@turbowarp/types-tw](https://github.com/TurboWarp/types-tw).
|
|
8
6
|
|
|
9
7
|
|Module|Status|
|
|
10
8
|
|:-:|:-:|
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const stream: JSZip.StreamHelper<'uint8array'>;
|
|
2
|
+
|
|
3
|
+
stream.on('data', data => {
|
|
4
|
+
data as Uint8Array
|
|
5
|
+
});
|
|
6
|
+
stream.on('data', (data, metadata) => {
|
|
7
|
+
metadata.percent as number
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
stream.pause();
|
|
11
|
+
stream.resume();
|
|
12
|
+
|
|
13
|
+
// @ts-expect-error
|
|
14
|
+
stream.on('whatever', () => {
|
|
15
|
+
|
|
16
|
+
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
class Fetch {
|
|
5
|
+
/** @returns {Scratch.Info} */
|
|
5
6
|
getInfo () {
|
|
6
7
|
return {
|
|
7
8
|
id: 'fetch',
|
|
@@ -17,8 +18,65 @@
|
|
|
17
18
|
defaultValue: 'https://extensions.turbowarp.org/hello.txt'
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
opcode: 'test',
|
|
24
|
+
text: 'test [STRING] [IMAGE] [BOOLEAN] [NUMBER] [MATRIX] [NOTE] [ANGLE] [COLOR]',
|
|
25
|
+
blockType: Scratch.BlockType.COMMAND,
|
|
26
|
+
hideFromPalette: false,
|
|
27
|
+
isTerminal: true,
|
|
28
|
+
arguments: {
|
|
29
|
+
STRING: {
|
|
30
|
+
type: Scratch.ArgumentType.STRING,
|
|
31
|
+
defaultValue: 'test',
|
|
32
|
+
menu: 'test1'
|
|
33
|
+
},
|
|
34
|
+
IMAGE: {
|
|
35
|
+
type: Scratch.ArgumentType.IMAGE,
|
|
36
|
+
dataURI: 'https://extensions.turbowarp.org/dango.png'
|
|
37
|
+
},
|
|
38
|
+
BOOLEAN: {
|
|
39
|
+
type: Scratch.ArgumentType.BOOLEAN
|
|
40
|
+
},
|
|
41
|
+
NUMBER: {
|
|
42
|
+
type: Scratch.ArgumentType.NUMBER,
|
|
43
|
+
defaultValue: 5,
|
|
44
|
+
},
|
|
45
|
+
MATRIX: {
|
|
46
|
+
type: Scratch.ArgumentType.MATRIX,
|
|
47
|
+
defaultValue: '0101001010000001000101110'
|
|
48
|
+
},
|
|
49
|
+
NOTE: {
|
|
50
|
+
type: Scratch.ArgumentType.NOTE,
|
|
51
|
+
defaultValue: '30'
|
|
52
|
+
},
|
|
53
|
+
ANGLE: {
|
|
54
|
+
type: Scratch.ArgumentType.ANGLE,
|
|
55
|
+
defaultValue: 30
|
|
56
|
+
},
|
|
57
|
+
COLOR: {
|
|
58
|
+
type: Scratch.ArgumentType.COLOR,
|
|
59
|
+
defaultValue: '#123456'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
opcode: 'button',
|
|
65
|
+
blockType: Scratch.BlockType.BUTTON,
|
|
66
|
+
func: 'MAKE_A_VARIABLE',
|
|
67
|
+
text: 'button text'
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
menus: {
|
|
71
|
+
test1: ['1', '2', '3'],
|
|
72
|
+
test2: {
|
|
73
|
+
acceptReporters: false,
|
|
74
|
+
items: [
|
|
75
|
+
{ text: 'text', value: 'value' },
|
|
76
|
+
'another value'
|
|
77
|
+
]
|
|
20
78
|
}
|
|
21
|
-
|
|
79
|
+
}
|
|
22
80
|
};
|
|
23
81
|
}
|
|
24
82
|
|
|
@@ -30,6 +88,17 @@
|
|
|
30
88
|
.then(r => r.text())
|
|
31
89
|
.catch(() => '');
|
|
32
90
|
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @param {unknown} args
|
|
94
|
+
*/
|
|
95
|
+
test (args) {
|
|
96
|
+
console.log(args);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (Scratch.extensions.unsandboxed) {
|
|
101
|
+
// ...
|
|
33
102
|
}
|
|
34
103
|
|
|
35
104
|
Scratch.extensions.register(new Fetch());
|
package/tests/test-scratch-vm.ts
CHANGED
|
@@ -61,3 +61,7 @@ vm.runtime.compatibilityMode as boolean
|
|
|
61
61
|
|
|
62
62
|
const costume = vm.runtime.getTargetForStage()?.getCostumes()?.[0];
|
|
63
63
|
costume?.skinId as number;
|
|
64
|
+
|
|
65
|
+
declare const util: VM.BlockUtility;
|
|
66
|
+
util.startHats('hats', {BROADCAST_OPTION: 'test'}) as VM.Thread[];
|
|
67
|
+
util.ioQuery('mouse', 'getIsDown', []);
|
package/types/jszip.d.ts
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
|
|
4
4
|
declare namespace JSZip {
|
|
5
5
|
// TODO
|
|
6
|
+
|
|
7
|
+
interface OutputTypes {
|
|
8
|
+
base64: string;
|
|
9
|
+
binarystring: string;
|
|
10
|
+
array: number[];
|
|
11
|
+
uint8array: Uint8Array;
|
|
12
|
+
arraybuffer: ArrayBuffer;
|
|
13
|
+
blob: Blob;
|
|
14
|
+
nodebuffer: Uint8Array; // actually a Node.js Buffer
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ProgressMetadata {
|
|
18
|
+
percent: number;
|
|
19
|
+
currentFile: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface StreamHelper<T extends keyof OutputTypes> {
|
|
23
|
+
resume(): void;
|
|
24
|
+
pause(): void;
|
|
25
|
+
on(event: 'data', callback: (data: OutputTypes[T], metadata: ProgressMetadata) => void): void;
|
|
26
|
+
on(event: 'end', callback: () => void): void;
|
|
27
|
+
on(event: 'error', callback: (error: Error) => void): void;
|
|
28
|
+
accumulate(updateCallback?: (metadata: ProgressMetadata) => void): Promise<OutputTypes[T]>;
|
|
29
|
+
}
|
|
6
30
|
}
|
|
7
31
|
|
|
8
32
|
declare class JSZip {
|
|
@@ -1,133 +1,251 @@
|
|
|
1
|
-
/// <reference path="./scratch-vm.d.ts" />
|
|
2
|
-
/// <reference path="./scratch-render.d.ts" />
|
|
3
|
-
|
|
4
1
|
declare namespace Scratch {
|
|
2
|
+
// Note that the 'B' in the BOOLEAN enums are capitalized in Scratch. It is not a typo in this file.
|
|
3
|
+
|
|
5
4
|
namespace ArgumentType {
|
|
6
|
-
/** @deprecated not tested -- do not rely on yet */
|
|
7
5
|
const ANGLE: 'angle';
|
|
8
6
|
const BOOLEAN: 'Boolean';
|
|
9
|
-
/** @deprecated not tested -- do not rely on yet */
|
|
10
7
|
const COLOR: 'color';
|
|
11
|
-
const
|
|
12
|
-
const STRING: 'string';
|
|
13
|
-
/** @deprecated not tested -- do not rely on yet */
|
|
8
|
+
const IMAGE: 'image';
|
|
14
9
|
const MATRIX: 'matrix';
|
|
15
|
-
/** @deprecated not tested -- do not rely on yet */
|
|
16
10
|
const NOTE: 'note';
|
|
17
|
-
|
|
18
|
-
const
|
|
11
|
+
const NUMBER: 'number';
|
|
12
|
+
const STRING: 'string';
|
|
19
13
|
}
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
|
|
22
15
|
namespace BlockType {
|
|
23
|
-
// The B in Boolean is supposed to be capitalized
|
|
24
16
|
const BOOLEAN: 'Boolean';
|
|
25
|
-
/** @deprecated
|
|
17
|
+
/** @deprecated very incomplete and not useful yet */
|
|
26
18
|
const BUTTON: 'button';
|
|
27
19
|
const COMMAND: 'command';
|
|
28
|
-
/** @deprecated
|
|
20
|
+
/** @deprecated does not work in compiler */
|
|
29
21
|
const CONDITIONAL: 'conditional';
|
|
22
|
+
/** @deprecated use HAT instead */
|
|
30
23
|
const EVENT: 'event';
|
|
31
24
|
const HAT: 'hat';
|
|
32
|
-
/** @deprecated
|
|
25
|
+
/** @deprecated does not work in compiler */
|
|
33
26
|
const LOOP: 'loop';
|
|
34
27
|
const REPORTER: 'reporter';
|
|
35
28
|
}
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
|
|
38
30
|
namespace TargetType {
|
|
39
31
|
const SPRITE: 'sprite';
|
|
40
32
|
const STAGE: 'stage';
|
|
41
33
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
interface
|
|
61
|
-
type:
|
|
34
|
+
|
|
35
|
+
interface AngleArgument {
|
|
36
|
+
type: 'angle';
|
|
37
|
+
/**
|
|
38
|
+
* Defaults to 0.
|
|
39
|
+
*/
|
|
40
|
+
defaultValue?: string | number;
|
|
41
|
+
}
|
|
42
|
+
interface BooleanArgument {
|
|
43
|
+
type: 'Boolean';
|
|
44
|
+
}
|
|
45
|
+
interface ColorArgument {
|
|
46
|
+
type: 'color';
|
|
47
|
+
/**
|
|
48
|
+
* Should be a hex color code. No alpha channel supported. Defaults to random color.
|
|
49
|
+
*/
|
|
50
|
+
defaultValue?: string | number;
|
|
51
|
+
}
|
|
52
|
+
interface NumberArgument {
|
|
53
|
+
type: 'number';
|
|
54
|
+
/**
|
|
55
|
+
* Defaults to 0.
|
|
56
|
+
*/
|
|
62
57
|
defaultValue?: string | number;
|
|
63
58
|
menu?: string;
|
|
64
59
|
}
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
interface StringArgument {
|
|
61
|
+
type: 'string';
|
|
62
|
+
/**
|
|
63
|
+
* Defaults to empty string.
|
|
64
|
+
*/
|
|
65
|
+
defaultValue?: string | number;
|
|
66
|
+
menu?: string;
|
|
67
|
+
}
|
|
68
|
+
interface MatrixArgument {
|
|
69
|
+
type: 'matrix';
|
|
70
|
+
/**
|
|
71
|
+
* Should be a 25 character long string of 1s and 0s.
|
|
72
|
+
* Numbers are technically accepted, but be aware that due to floating point precision, some detail may be lost.
|
|
73
|
+
* Technically optional, but behaves strangely with no default value.
|
|
74
|
+
*/
|
|
75
|
+
defaultValue?: string | number;
|
|
76
|
+
}
|
|
77
|
+
interface NoteArgument {
|
|
78
|
+
type: 'note';
|
|
79
|
+
/**
|
|
80
|
+
* Defaults to 0 ("C (0)")
|
|
81
|
+
*/
|
|
82
|
+
defaultValue?: string | number;
|
|
83
|
+
}
|
|
84
|
+
interface ImageArgument {
|
|
85
|
+
type: 'image';
|
|
86
|
+
dataURI: string;
|
|
87
|
+
/**
|
|
88
|
+
* Defaults to false.
|
|
89
|
+
*/
|
|
90
|
+
flipRTL?: boolean;
|
|
91
|
+
}
|
|
92
|
+
type Argument = (
|
|
93
|
+
AngleArgument |
|
|
94
|
+
BooleanArgument |
|
|
95
|
+
ColorArgument |
|
|
96
|
+
NumberArgument |
|
|
97
|
+
StringArgument |
|
|
98
|
+
MatrixArgument |
|
|
99
|
+
NoteArgument |
|
|
100
|
+
ImageArgument
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
interface AbstractBlock {
|
|
67
104
|
opcode: string;
|
|
68
|
-
|
|
69
|
-
text:
|
|
70
|
-
arguments?: Record<string,
|
|
71
|
-
|
|
105
|
+
func?: string;
|
|
106
|
+
text: string | string[];
|
|
107
|
+
arguments?: Record<string, Argument>;
|
|
108
|
+
hideFromPalette?: boolean;
|
|
109
|
+
filter?: Array<'target' | 'sprite'>;
|
|
110
|
+
blockIconURI?: string;
|
|
72
111
|
}
|
|
73
|
-
|
|
74
|
-
|
|
112
|
+
interface BooleanBlock extends AbstractBlock {
|
|
113
|
+
blockType: 'Boolean';
|
|
114
|
+
}
|
|
115
|
+
interface ButtonBlock extends AbstractBlock {
|
|
116
|
+
blockType: 'button';
|
|
117
|
+
func: 'MAKE_A_LIST' | 'MAKE_A_PROCEDURE' | 'MAKE_A_VARIABLE';
|
|
118
|
+
}
|
|
119
|
+
interface CommandBlock extends AbstractBlock {
|
|
120
|
+
blockType: 'command';
|
|
121
|
+
/**
|
|
122
|
+
* Defaults to false.
|
|
123
|
+
*/
|
|
124
|
+
isTerminal?: boolean;
|
|
125
|
+
}
|
|
126
|
+
interface ConditionalBlock extends AbstractBlock {
|
|
127
|
+
blockType: 'conditional';
|
|
128
|
+
/**
|
|
129
|
+
* Defaults to false.
|
|
130
|
+
*/
|
|
131
|
+
isTerminal?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Defaults to 1.
|
|
134
|
+
*/
|
|
135
|
+
branchCount?: number;
|
|
136
|
+
}
|
|
137
|
+
interface EventBlock extends AbstractBlock {
|
|
138
|
+
blockType: 'event';
|
|
139
|
+
/**
|
|
140
|
+
* This must be explicitly set to false, otherwise the block will not work.
|
|
141
|
+
* Event blocks cannot be edge activated. Use hat instead.
|
|
142
|
+
*/
|
|
143
|
+
isEdgeActivated: false;
|
|
144
|
+
/**
|
|
145
|
+
* Defaults to false.
|
|
146
|
+
*/
|
|
147
|
+
shouldRestartExistingThreads?: boolean;
|
|
148
|
+
}
|
|
149
|
+
interface HatBlock extends AbstractBlock {
|
|
150
|
+
blockType: 'hat';
|
|
151
|
+
/**
|
|
152
|
+
* Defaults to true.
|
|
153
|
+
*/
|
|
154
|
+
isEdgeActivated?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Defaults to false.
|
|
157
|
+
*/
|
|
158
|
+
shouldRestartExistingThreads?: boolean;
|
|
159
|
+
}
|
|
160
|
+
interface ReporterBlock extends AbstractBlock {
|
|
161
|
+
blockType: 'reporter';
|
|
162
|
+
/**
|
|
163
|
+
* Defaults to false.
|
|
164
|
+
*/
|
|
165
|
+
disableMonitor?: boolean;
|
|
166
|
+
}
|
|
167
|
+
interface LoopBlock extends AbstractBlock {
|
|
168
|
+
blockType: 'loop';
|
|
169
|
+
/**
|
|
170
|
+
* Defaults to false.
|
|
171
|
+
*/
|
|
172
|
+
isTerminal?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Defaults to 1.
|
|
175
|
+
*/
|
|
176
|
+
branchCount?: number;
|
|
177
|
+
}
|
|
178
|
+
type Block = (
|
|
179
|
+
BooleanBlock |
|
|
180
|
+
ButtonBlock |
|
|
181
|
+
CommandBlock |
|
|
182
|
+
ConditionalBlock |
|
|
183
|
+
EventBlock |
|
|
184
|
+
HatBlock |
|
|
185
|
+
ReporterBlock |
|
|
186
|
+
LoopBlock
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
interface Menu {
|
|
75
190
|
acceptReporters?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* A list of static items in the menu, or the name of the dynamic menu function.
|
|
193
|
+
*/
|
|
76
194
|
items: Array<string | {
|
|
77
195
|
text: string;
|
|
78
196
|
value: string;
|
|
79
|
-
}
|
|
197
|
+
}> | string;
|
|
80
198
|
}
|
|
81
|
-
|
|
82
|
-
interface
|
|
199
|
+
|
|
200
|
+
interface Info {
|
|
83
201
|
id: string;
|
|
84
|
-
|
|
202
|
+
|
|
85
203
|
/**
|
|
86
|
-
* Defaults to ID if not specified.
|
|
204
|
+
* Defaults to extension ID if not specified.
|
|
87
205
|
*/
|
|
88
|
-
name?:
|
|
89
|
-
|
|
206
|
+
name?: string;
|
|
207
|
+
|
|
90
208
|
/**
|
|
91
209
|
* Should be a hex color code.
|
|
92
210
|
*/
|
|
93
211
|
color1?: string;
|
|
94
|
-
|
|
212
|
+
|
|
95
213
|
/**
|
|
96
214
|
* Should be a hex color code.
|
|
97
215
|
*/
|
|
98
216
|
color2?: string;
|
|
99
|
-
|
|
217
|
+
|
|
100
218
|
/**
|
|
101
219
|
* Should be a hex color code.
|
|
102
220
|
*/
|
|
103
221
|
color3?: string;
|
|
104
|
-
|
|
222
|
+
|
|
105
223
|
/**
|
|
106
224
|
* Should be a data: URI
|
|
107
225
|
*/
|
|
108
226
|
menuIconURI?: string;
|
|
109
|
-
|
|
227
|
+
|
|
110
228
|
/**
|
|
111
229
|
* Should be a data: URI
|
|
112
230
|
*/
|
|
113
231
|
blockIconURI?: string;
|
|
114
|
-
|
|
232
|
+
|
|
115
233
|
docsURI?: string;
|
|
116
|
-
|
|
117
|
-
blocks: (
|
|
118
|
-
menus?: Record<string,
|
|
234
|
+
|
|
235
|
+
blocks: (Block | string)[];
|
|
236
|
+
menus?: Record<string, Menu | string[]>;
|
|
119
237
|
}
|
|
120
|
-
|
|
238
|
+
|
|
121
239
|
interface Extension {
|
|
122
|
-
getInfo():
|
|
240
|
+
getInfo(): Info;
|
|
123
241
|
}
|
|
124
|
-
|
|
242
|
+
|
|
125
243
|
namespace extensions {
|
|
126
244
|
function register(extensionObject: Extension): void;
|
|
127
245
|
|
|
128
246
|
/**
|
|
129
|
-
* True if the extension is running unsandboxed.
|
|
247
|
+
* True if the extension is running unsandboxed, otherwise undefined.
|
|
130
248
|
*/
|
|
131
|
-
const unsandboxed: boolean;
|
|
249
|
+
const unsandboxed: undefined | boolean;
|
|
132
250
|
}
|
|
133
251
|
}
|
package/types/scratch-vm.d.ts
CHANGED
|
@@ -614,7 +614,72 @@ declare namespace VM {
|
|
|
614
614
|
}
|
|
615
615
|
|
|
616
616
|
interface StackFrame {
|
|
617
|
-
|
|
617
|
+
isLoop: boolean;
|
|
618
|
+
warpMode: boolean;
|
|
619
|
+
justReported: unknown;
|
|
620
|
+
reporting: string;
|
|
621
|
+
reported: unknown;
|
|
622
|
+
/** @deprecated unused */
|
|
623
|
+
waitingReporter: unknown;
|
|
624
|
+
params: unknown;
|
|
625
|
+
executionContext: unknown;
|
|
626
|
+
reset(): void;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
interface BlockUtility {
|
|
630
|
+
sequencer: Sequencer;
|
|
631
|
+
thread: Thread;
|
|
632
|
+
_nowObj: {
|
|
633
|
+
now(): number;
|
|
634
|
+
};
|
|
635
|
+
nowObj: BlockUtility['_nowObj'],
|
|
636
|
+
target: Target;
|
|
637
|
+
runtime: Runtime;
|
|
638
|
+
stackFrame: StackFrame;
|
|
639
|
+
stackTimerFinished(): boolean;
|
|
640
|
+
stackTimerNeedsInit(): boolean;
|
|
641
|
+
startStackTimer(milliseconds: number): void;
|
|
642
|
+
yield(): void;
|
|
643
|
+
yieldTick(): void;
|
|
644
|
+
startBranch(branchNumber: number, isLoop: boolean): void;
|
|
645
|
+
/**
|
|
646
|
+
* @see {Runtime.stopAll}
|
|
647
|
+
*/
|
|
648
|
+
stopAll(): void;
|
|
649
|
+
/**
|
|
650
|
+
* @see {Runtime.stopForTarget}
|
|
651
|
+
*/
|
|
652
|
+
stopOtherTargetThreads(): void;
|
|
653
|
+
/**
|
|
654
|
+
* @see {Thread.stopThisScript}
|
|
655
|
+
*/
|
|
656
|
+
stopThisScript(): void;
|
|
657
|
+
/**
|
|
658
|
+
* @see {Blocks.getProcedureParamNamesAndIds}
|
|
659
|
+
*/
|
|
660
|
+
getProcedureParamNamesAndIds(): [string[], string[]];
|
|
661
|
+
/**
|
|
662
|
+
* @see {Blocks.getProcedureParamNamesIdsAndDefaults}
|
|
663
|
+
*/
|
|
664
|
+
getProcedureParamNamesIdsAndDefaults(): [string[], string[], string[]];
|
|
665
|
+
/**
|
|
666
|
+
* @see {Thread.initParams}
|
|
667
|
+
*/
|
|
668
|
+
initParams(): void;
|
|
669
|
+
/**
|
|
670
|
+
* @see {Thread.pushParam}
|
|
671
|
+
*/
|
|
672
|
+
pushParam(name: string, value: ScratchCompatibleValue): void;
|
|
673
|
+
/**
|
|
674
|
+
* @see {Thread.getParam}
|
|
675
|
+
*/
|
|
676
|
+
getParam(name: string): ScratchCompatibleValue;
|
|
677
|
+
/**
|
|
678
|
+
* Use instead of runtime.startHats inside blocks.
|
|
679
|
+
* @see {Runtime.startHats}
|
|
680
|
+
*/
|
|
681
|
+
startHats: Runtime['startHats'];
|
|
682
|
+
ioQuery<Device extends keyof IODevices>(device: Device, func: keyof IODevices[Device], args: unknown[]): unknown;
|
|
618
683
|
}
|
|
619
684
|
|
|
620
685
|
const enum ThreadStatus {
|
|
@@ -637,16 +702,19 @@ declare namespace VM {
|
|
|
637
702
|
blockGlowInFrame: string | null;
|
|
638
703
|
warpTimer: Timer | null;
|
|
639
704
|
justReported: unknown;
|
|
705
|
+
reuseStackForNextBlock(blockId: string): void;
|
|
640
706
|
pushStack(blockId: string): void;
|
|
641
707
|
popStack(): string;
|
|
642
708
|
peekStack(): string;
|
|
643
709
|
peekStackFrame(): StackFrame | null;
|
|
644
710
|
peekParentStackFrame(): StackFrame | null;
|
|
711
|
+
pushReportedValue(value: ScratchCompatibleValue): void;
|
|
645
712
|
initParams(): void;
|
|
646
713
|
pushParam(name: string, value: ScratchCompatibleValue): void;
|
|
647
714
|
getParam(name: string): ScratchCompatibleValue | null;
|
|
648
715
|
atStackTop(): boolean;
|
|
649
716
|
goToNextBlock(): void;
|
|
717
|
+
stopThisScript(): void;
|
|
650
718
|
isRecursiveCall(procedureCode: string): boolean;
|
|
651
719
|
stackClick: boolean;
|
|
652
720
|
updateMonitor: boolean;
|
|
@@ -1117,7 +1185,7 @@ declare namespace VM {
|
|
|
1117
1185
|
|
|
1118
1186
|
_getMonitorThreadCount(threads: Thread[]): number;
|
|
1119
1187
|
|
|
1120
|
-
startHats(opcode: string, matchFields?: Record<string, unknown>, target?: Target):
|
|
1188
|
+
startHats(opcode: string, matchFields?: Record<string, unknown>, target?: Target): Thread[];
|
|
1121
1189
|
|
|
1122
1190
|
toggleScript(topBlockId: string, options?: {
|
|
1123
1191
|
target?: string;
|