You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/loader.md
+10-2Lines changed: 10 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -243,15 +243,23 @@ The following utility functions are mixed into the module's exports.
243
243
Allocatesanewstringinthemodule's memory and returns a pointer to it. Requires `--exportRuntime` for access to `__new`.
244
244
245
245
*```ts
246
-
function __newArray(id: number, values: number[]): number
246
+
function __newArray(
247
+
id: number,
248
+
values: valuesOrCapacity?: number[] | ArrayBufferView | number
249
+
): number
247
250
```
248
-
Allocatesanewarrayinthemodule's memory and returns a pointer to it. The `id` is the unique runtime id of the respective array class. If you are using `Int32Array` for example, the best way to know the id is an `export const Int32Array_ID = idof<Int32Array>()`. Requires `--exportRuntime` for access to `__new`.
251
+
Allocatesanewarrayinthemodule's memory and returns a pointer to it. The `id` is the unique runtime id of the respective array class. If you are using `Int32Array` for example, the best way to know the id is an `export const Int32Array_ID = idof<Int32Array>()`. Requires `--exportRuntime` for access to `__new`. The `values` parameter сan also be used to pre-allocate an otherwise empty array of a certain capacity.
249
252
250
253
*```ts
251
254
function __getString(ptr: number): string
252
255
```
253
256
Copiesastring's value from the module'smemorytoaJavaScriptstring. `ptr`mustnotbezero.
254
257
258
+
*```ts
259
+
function __getFunction(ptr: number): ((...args: unknown[]) => unknown) | null
260
+
```
261
+
Getsacallablefunction object from the module's memory containing its table index. `ptr` must not be zero.
262
+
255
263
*```ts
256
264
function __getArrayBuffer(ptr: number): ArrayBuffer
Copy file name to clipboardExpand all lines: src/peculiarities.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,8 @@ Decorators work more like actual compiler annotations in AssemblyScript.
15
15
| `@inline` | Requests inlining of a constant or function.
16
16
| `@lazy` | Requests lazy compilation of a variable. Useful to avoid unnecessary globals.
17
17
| `@global` | Registers an element to be part of the global scope.
18
+
| `@final` | Annotates a class as final, that is it cannot be subclassed.
19
+
| `@unmanaged` | Annotates a class as not tracked by GC, essentially C structs.
18
20
| `@external` | Changes the external name of an imported element. `@external(module, name)` changes both the module and element name, `@external(name)` changes the element name only.
19
21
| `@operator` | Annotates a method as a binary operator overload. See below.
0 commit comments