(
instance: OpaqueTableNativeHandle | TableDescriptor,
value?: any
)
| 40 | */ |
| 41 | export class Table { |
| 42 | constructor( |
| 43 | instance: OpaqueTableNativeHandle | TableDescriptor, |
| 44 | value?: any |
| 45 | ) { |
| 46 | if (isTableDescriptor(instance)) { |
| 47 | NativeWASM.createTable( |
| 48 | this, |
| 49 | { |
| 50 | element: |
| 51 | instance.element === 'anyfunc' |
| 52 | ? NativeTableElementType.AnyFunc |
| 53 | : NativeTableElementType.ExternRef, |
| 54 | initialSize: instance.initial, |
| 55 | maxSize: instance.maximum, |
| 56 | }, |
| 57 | value |
| 58 | ); |
| 59 | } else { |
| 60 | if (!NativeWASM.copyNativeHandle(this, instance)) { |
| 61 | throw new Error( |
| 62 | 'Invalid object passed to WebAssembly.Table() constructor' |
| 63 | ); |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | public get length(): number { |
| 69 | return NativeWASM.getTableSize(this); |
nothing calls this directly
no test coverage detected