init(arrayLiteral:)
JSTypedArray.swift:41required convenience init(arrayLiteral elements: Element...)
required convenience init(arrayLiteral elements: Element...)
s13JavaScriptKit12JSTypedArrayC12arrayLiteralACyxGxd_tcfc
What are these?1GULO
import JavaScriptKit
Swift framework to interact with JavaScript through WebAssembly.
class JSTypedArray<Element> where Element : TypedArrayElement
A wrapper around all JavaScript TypedArray
classes that exposes their properties in a type-safe way.
convenience init(_ array: [Element])
Initialize a new instance of TypedArray in JavaScript environment with given elements.
convenience init<S>(_ sequence: S) where Element == S.Element, S : Sequence
Convenience initializer for Sequence
.
init(length: Int)
Initialize a new instance of TypedArray in JavaScript environment with given length. All the elements will be initialized to zero.
required init(unsafelyWrapping jsObject: JSObject)
class var constructor: JSFunction? { get }
var jsObject: JSObject
var lengthInBytes: Int { get }
Length (in bytes) of the typed array. The value is established when a TypedArray is constructed and cannot be changed. If the TypedArray is not specifying a byteOffset
or a length
, the length
of the referenced ArrayBuffer
will be returned.
subscript(index: Int) -> Element { get set }
func withUnsafeBytes<R>(_ body: (UnsafeBufferPointer<Element>) throws -> R) rethrows -> R
Calls the given closure with a pointer to a copy of the underlying bytes of the array’s storage.
func withUnsafeBytesAsync<R>(_ body: (UnsafeBufferPointer<Element>) async throws -> R) async rethrows -> R
Calls the given async closure with a pointer to a copy of the underlying bytes of the array’s storage.