@@ -7,15 +7,15 @@ import _CJavaScriptKit
7
7
public protocol TypedArrayElement {
8
8
associatedtype Element : ConvertibleToJSValue , Construct ibleFromJSValue = Self
9
9
/// The constructor function for the TypedArray class for this particular kind of number
10
- static var typedArrayClass : JSFunction { get }
10
+ static var typedArrayClass : JSObject { get }
11
11
}
12
12
13
13
/// A wrapper around all [JavaScript `TypedArray`
14
14
/// classes](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)
15
15
/// that exposes their properties in a type-safe way.
16
16
public final class JSTypedArray < Traits> : JSBridgedClass , ExpressibleByArrayLiteral where Traits: TypedArrayElement {
17
17
public typealias Element = Traits . Element
18
- public class var constructor : JSFunction ? { Traits . typedArrayClass }
18
+ public class var constructor : JSObject ? { Traits . typedArrayClass }
19
19
public var jsObject : JSObject
20
20
21
21
public subscript( _ index: Int ) -> Element {
@@ -141,64 +141,64 @@ public final class JSTypedArray<Traits>: JSBridgedClass, ExpressibleByArrayLiter
141
141
}
142
142
143
143
extension Int : TypedArrayElement {
144
- public static var typedArrayClass : JSFunction {
144
+ public static var typedArrayClass : JSObject {
145
145
#if _pointerBitWidth(_32)
146
- return JSObject . global. Int32Array. function !
146
+ return JSObject . global. Int32Array. object !
147
147
#elseif _pointerBitWidth(_64)
148
- return JSObject . global. Int64Array. function !
148
+ return JSObject . global. Int64Array. object !
149
149
#else
150
150
#error("Unsupported pointer width")
151
151
#endif
152
152
}
153
153
}
154
154
155
155
extension UInt : TypedArrayElement {
156
- public static var typedArrayClass : JSFunction {
156
+ public static var typedArrayClass : JSObject {
157
157
#if _pointerBitWidth(_32)
158
- return JSObject . global. Uint32Array. function !
158
+ return JSObject . global. Uint32Array. object !
159
159
#elseif _pointerBitWidth(_64)
160
- return JSObject . global. Uint64Array. function !
160
+ return JSObject . global. Uint64Array. object !
161
161
#else
162
162
#error("Unsupported pointer width")
163
163
#endif
164
164
}
165
165
}
166
166
167
167
extension Int8 : TypedArrayElement {
168
- public static var typedArrayClass : JSFunction { JSObject . global. Int8Array. function ! }
168
+ public static var typedArrayClass : JSObject { JSObject . global. Int8Array. object ! }
169
169
}
170
170
171
171
extension UInt8 : TypedArrayElement {
172
- public static var typedArrayClass : JSFunction { JSObject . global. Uint8Array. function ! }
172
+ public static var typedArrayClass : JSObject { JSObject . global. Uint8Array. object ! }
173
173
}
174
174
175
175
extension Int16 : TypedArrayElement {
176
- public static var typedArrayClass : JSFunction { JSObject . global. Int16Array. function ! }
176
+ public static var typedArrayClass : JSObject { JSObject . global. Int16Array. object ! }
177
177
}
178
178
179
179
extension UInt16 : TypedArrayElement {
180
- public static var typedArrayClass : JSFunction { JSObject . global. Uint16Array. function ! }
180
+ public static var typedArrayClass : JSObject { JSObject . global. Uint16Array. object ! }
181
181
}
182
182
183
183
extension Int32 : TypedArrayElement {
184
- public static var typedArrayClass : JSFunction { JSObject . global. Int32Array. function ! }
184
+ public static var typedArrayClass : JSObject { JSObject . global. Int32Array. object ! }
185
185
}
186
186
187
187
extension UInt32 : TypedArrayElement {
188
- public static var typedArrayClass : JSFunction { JSObject . global. Uint32Array. function ! }
188
+ public static var typedArrayClass : JSObject { JSObject . global. Uint32Array. object ! }
189
189
}
190
190
191
191
extension Float32 : TypedArrayElement {
192
- public static var typedArrayClass : JSFunction { JSObject . global. Float32Array. function ! }
192
+ public static var typedArrayClass : JSObject { JSObject . global. Float32Array. object ! }
193
193
}
194
194
195
195
extension Float64 : TypedArrayElement {
196
- public static var typedArrayClass : JSFunction { JSObject . global. Float64Array. function ! }
196
+ public static var typedArrayClass : JSObject { JSObject . global. Float64Array. object ! }
197
197
}
198
198
199
199
public enum JSUInt8Clamped : TypedArrayElement {
200
200
public typealias Element = UInt8
201
- public static var typedArrayClass : JSFunction { JSObject . global. Uint8ClampedArray. function ! }
201
+ public static var typedArrayClass : JSObject { JSObject . global. Uint8ClampedArray. object ! }
202
202
}
203
203
204
204
public typealias JSUInt8ClampedArray = JSTypedArray < JSUInt8Clamped >
0 commit comments