MCPcopy Create free account
hub / github.com/callstackincubator/polygen / constructor

Method constructor

packages/polygen/src/api/Table.ts:42–66  ·  view source on GitHub ↗
(
    instance: OpaqueTableNativeHandle | TableDescriptor,
    value?: any
  )

Source from the content-addressed store, hash-verified

40 */
41export 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);

Callers

nothing calls this directly

Calls 3

isTableDescriptorFunction · 0.85
createTableMethod · 0.65
copyNativeHandleMethod · 0.65

Tested by

no test coverage detected