init(_:)
Convenience initializer for Sequence
.
convenience init<S>(_ sequence: S) where S : Sequence, Traits.Element == S.Element
Convenience initializer for Sequence
.
convenience init<S>(_ sequence: S) where S : Sequence, Traits.Element == S.Element
s13JavaScriptKit12JSTypedArrayCyACyxGqd__cSTRd__7ElementQyd__AERtzlufc
What are these?4YILC
import JavaScriptKit
Swift framework to interact with JavaScript through WebAssembly.
final class JSTypedArray<Traits> where Traits : TypedArrayElement
A wrapper around all JavaScript TypedArray
classes that exposes their properties in a type-safe way.
protocol Sequence<Element>
A type that provides sequential, iterated access to its elements.
associatedtype Element : ConstructibleFromJSValue, ConvertibleToJSValue = Self
associatedtype Element where Self.Element == Self.Iterator.Element
A type representing the sequence’s elements.
convenience init(_ array: [Element])
Initialize a new instance of TypedArray in JavaScript environment with given elements.
required convenience init(arrayLiteral elements: Element...)
convenience init(buffer: UnsafeBufferPointer<Element>)
Initialize a new instance of TypedArray in JavaScript environment with given buffer contents.
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 length: Int { get }
Length (in elements) of the typed array.
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 copyMemory(to buffer: UnsafeMutableBufferPointer<Element>)
Copies the contents of the array to the given buffer.
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.
typealias Element = Traits.Element