diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2021-02-11 18:00:01 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 16:00:01 -0800 |
commit | 18c24eb4d0694beb971581d59a4570826c5fa01f (patch) | |
tree | df0a6a3404b20712befe354cda4b13597d45e62f /lib/std/private | |
parent | 81533a0014a8372207426dc9d067aff4b59db8af (diff) | |
download | Nim-18c24eb4d0694beb971581d59a4570826c5fa01f.tar.gz |
add system random to stdlib: std/sysrand (#16459)
Diffstat (limited to 'lib/std/private')
-rw-r--r-- | lib/std/private/jsutils.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/std/private/jsutils.nim b/lib/std/private/jsutils.nim index 47a6caa2b..aa2e984ff 100644 --- a/lib/std/private/jsutils.nim +++ b/lib/std/private/jsutils.nim @@ -5,14 +5,20 @@ when defined(js): ArrayBuffer* = ref object of JsRoot Float64Array* = ref object of JsRoot Uint32Array* = ref object of JsRoot + Uint8Array* = ref object of JsRoot BigUint64Array* = ref object of JsRoot + func newArrayBuffer*(n: int): ArrayBuffer {.importjs: "new ArrayBuffer(#)".} func newFloat64Array*(buffer: ArrayBuffer): Float64Array {.importjs: "new Float64Array(#)".} func newUint32Array*(buffer: ArrayBuffer): Uint32Array {.importjs: "new Uint32Array(#)".} func newBigUint64Array*(buffer: ArrayBuffer): BigUint64Array {.importjs: "new BigUint64Array(#)".} + + func newUint8Array*(n: int): Uint8Array {.importjs: "new Uint8Array(#)".} + func `[]`*(arr: Uint32Array, i: int): uint32 {.importjs: "#[#]".} + func `[]`*(arr: Uint8Array, i: int): uint8 {.importjs: "#[#]".} func `[]`*(arr: BigUint64Array, i: int): JsBigInt {.importjs: "#[#]".} func `[]=`*(arr: Float64Array, i: int, v: float) {.importjs: "#[#] = #".} |