File: es2022SharedMemory.types

package info (click to toggle)
node-typescript 4.8.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 523,068 kB
  • sloc: javascript: 1,735,777; makefile: 7; sh: 1
file content (56 lines) | stat: -rw-r--r-- 2,680 bytes parent folder | download | duplicates (2)
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
49
50
51
52
53
54
55
56
=== tests/cases/conformance/es2022/es2022SharedMemory.ts ===
const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024);
>sab : SharedArrayBuffer
>new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024) : SharedArrayBuffer
>SharedArrayBuffer : SharedArrayBufferConstructor
>Int32Array.BYTES_PER_ELEMENT * 1024 : number
>Int32Array.BYTES_PER_ELEMENT : number
>Int32Array : Int32ArrayConstructor
>BYTES_PER_ELEMENT : number
>1024 : 1024

const int32 = new Int32Array(sab);
>int32 : Int32Array
>new Int32Array(sab) : Int32Array
>Int32Array : Int32ArrayConstructor
>sab : SharedArrayBuffer

const waitValue = Atomics.wait(int32, 0, 0);
>waitValue : "ok" | "not-equal" | "timed-out"
>Atomics.wait(int32, 0, 0) : "ok" | "not-equal" | "timed-out"
>Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "ok" | "not-equal" | "timed-out"; }
>Atomics : Atomics
>wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "ok" | "not-equal" | "timed-out"; }
>int32 : Int32Array
>0 : 0
>0 : 0

const { async, value } = Atomics.waitAsync(int32, 0, BigInt(0));
>async : boolean
>value : "ok" | "not-equal" | "timed-out" | Promise<"ok" | "not-equal" | "timed-out">
>Atomics.waitAsync(int32, 0, BigInt(0)) : { async: false; value: "ok" | "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "not-equal" | "timed-out">; }
>Atomics.waitAsync : (typedArray: Int32Array | BigInt64Array, index: number, value: bigint, timeout?: number | undefined) => { async: false; value: "ok" | "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "not-equal" | "timed-out">; }
>Atomics : Atomics
>waitAsync : (typedArray: Int32Array | BigInt64Array, index: number, value: bigint, timeout?: number | undefined) => { async: false; value: "ok" | "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "not-equal" | "timed-out">; }
>int32 : Int32Array
>0 : 0
>BigInt(0) : bigint
>BigInt : BigIntConstructor
>0 : 0

const main = async () => {
>main : () => Promise<void>
>async () => {    if (async) {        await value;    }} : () => Promise<void>

    if (async) {
>async : boolean

        await value;
>await value : "ok" | "not-equal" | "timed-out"
>value : Promise<"ok" | "not-equal" | "timed-out">
    }
}
main();
>main() : Promise<void>
>main : () => Promise<void>