forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
34
Kha/Tools/macos/std/js/lib/webassembly/CompileError.hx
Normal file
34
Kha/Tools/macos/std/js/lib/webassembly/CompileError.hx
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package js.lib.webassembly;
|
||||
|
||||
/**
|
||||
A WebAssembly `CompileError` object indicates an error during WebAssembly
|
||||
decoding or validation.
|
||||
|
||||
Documentation [CompileError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
|
||||
**/
|
||||
@:native("WebAssembly.CompileError")
|
||||
extern class CompileError extends js.lib.Error {
|
||||
function new(?message:String):Void;
|
||||
}
|
62
Kha/Tools/macos/std/js/lib/webassembly/Global.hx
Normal file
62
Kha/Tools/macos/std/js/lib/webassembly/Global.hx
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package js.lib.webassembly;
|
||||
|
||||
/**
|
||||
A WebAssembly `Global` object represents a global variable instance, accessible from
|
||||
both JavaScript and importable/exportable across one or more WebAssembly `Module` instances.
|
||||
This allows dynamic linking of multiple modules.
|
||||
|
||||
Documentation [Global](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Global) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
|
||||
**/
|
||||
@:native("WebAssembly.Global")
|
||||
extern class Global {
|
||||
/**
|
||||
The value contained inside the global variable — this can be used to directly set
|
||||
and get the global's value.
|
||||
**/
|
||||
var value:Any;
|
||||
|
||||
@:pure function new(descriptor:GlobalDescriptor, value:Any):Void;
|
||||
|
||||
/**
|
||||
Old-style method that returns the value contained inside the global variable.
|
||||
*/
|
||||
@:pure function valueOf():Any;
|
||||
}
|
||||
|
||||
typedef GlobalDescriptor = {
|
||||
var value:ValueType;
|
||||
|
||||
/**
|
||||
By default, this is false.
|
||||
*/
|
||||
var ?mutable:Bool;
|
||||
}
|
||||
|
||||
enum abstract ValueType(String) {
|
||||
var I32 = "i32";
|
||||
var I64 = "i64";
|
||||
var F32 = "f32";
|
||||
var F64 = "f64";
|
||||
}
|
43
Kha/Tools/macos/std/js/lib/webassembly/Instance.hx
Normal file
43
Kha/Tools/macos/std/js/lib/webassembly/Instance.hx
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package js.lib.webassembly;
|
||||
|
||||
import haxe.Constraints.Function;
|
||||
|
||||
/**
|
||||
A WebAssembly `Instance` object is a stateful, executable instance of a WebAssembly `Module`.
|
||||
Instance objects contain all the [Exported WebAssembly functions](https://developer.mozilla.org/en-US/docs/WebAssembly/Exported_functions)
|
||||
that allow calling into WebAssembly code from JavaScript.
|
||||
|
||||
Documentation [Instance](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
|
||||
**/
|
||||
@:native("WebAssembly.Instance")
|
||||
extern class Instance {
|
||||
/**
|
||||
Returns an object containing as its members all the functions exported from
|
||||
the WebAssembly module instance, to allow them to be accessed and used by JavaScript.
|
||||
**/
|
||||
var exports(default, never):Dynamic<Function>;
|
||||
|
||||
@:pure function new(module:Module, ?importObject:{}):Void;
|
||||
}
|
34
Kha/Tools/macos/std/js/lib/webassembly/LinkError.hx
Normal file
34
Kha/Tools/macos/std/js/lib/webassembly/LinkError.hx
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package js.lib.webassembly;
|
||||
|
||||
/**
|
||||
A WebAssembly `LinkError` object indicates an error during module instantiation
|
||||
(besides [traps](http://webassembly.org/docs/semantics/#traps) from the start function).
|
||||
|
||||
Documentation [LinkError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/LinkError) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/LinkError$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
|
||||
**/
|
||||
@:native("WebAssembly.LinkError")
|
||||
extern class LinkError extends js.lib.Error {
|
||||
function new(?message:String):Void;
|
||||
}
|
63
Kha/Tools/macos/std/js/lib/webassembly/Memory.hx
Normal file
63
Kha/Tools/macos/std/js/lib/webassembly/Memory.hx
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package js.lib.webassembly;
|
||||
|
||||
/**
|
||||
A new WebAssembly `Memory` object which is a resizable ArrayBuffer that holds the raw bytes of memory
|
||||
accessed by a WebAssembly WebAssembly `Instance`.
|
||||
|
||||
A memory created by JavaScript or in WebAssembly code will be accessible and mutable from
|
||||
both JavaScript and WebAssembly.
|
||||
|
||||
Documentation [Memory](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
|
||||
**/
|
||||
@:native("WebAssembly.Memory")
|
||||
extern class Memory {
|
||||
/**
|
||||
An accessor property that returns the buffer contained in the memory.
|
||||
**/
|
||||
final buffer:js.lib.ArrayBuffer;
|
||||
|
||||
@:pure function new(memoryDescriptor:MemoryDescriptor):Void;
|
||||
|
||||
/**
|
||||
Increases the size of the memory instance by a specified number of WebAssembly pages
|
||||
(each one is 64KB in size).
|
||||
**/
|
||||
function grow(number:Int):Int;
|
||||
}
|
||||
|
||||
typedef MemoryDescriptor = {
|
||||
/**
|
||||
The initial size of the WebAssembly Memory, in units of WebAssembly pages.
|
||||
**/
|
||||
var initial:Int;
|
||||
|
||||
/**
|
||||
The maximum size the WebAssembly Memory is allowed to grow to, in units of WebAssembly pages.
|
||||
When present, the `maximum` parameter acts as a hint to the engine to reserve memory up front.
|
||||
However, the engine may ignore or clamp this reservation request.
|
||||
In general, most WebAssembly modules shouldn't need to set a `maximum`.
|
||||
*/
|
||||
var ?maximum:Int;
|
||||
}
|
72
Kha/Tools/macos/std/js/lib/webassembly/Module.hx
Normal file
72
Kha/Tools/macos/std/js/lib/webassembly/Module.hx
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package js.lib.webassembly;
|
||||
|
||||
import js.lib.BufferSource;
|
||||
|
||||
/**
|
||||
A WebAssembly `Module` object contains stateless WebAssembly code that has already
|
||||
been compiled by the browser and can be efficiently [shared with Workers](https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage),
|
||||
and instantiated multiple times. To instantiate the module, call
|
||||
[the secondary overload of `WebAssembly.instantiate()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate#Secondary_overload_%E2%80%94_taking_a_module_object_instance).
|
||||
|
||||
Documentation [Module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
|
||||
**/
|
||||
@:native("WebAssembly.Module")
|
||||
extern class Module {
|
||||
@:pure function new(bufferSource:BufferSource):Void;
|
||||
|
||||
/**
|
||||
Given a `Module` and string, returns a copy of the contents of all custom sections
|
||||
in the module with the given string name.
|
||||
**/
|
||||
@:pure static function customSections(module:Module, sectionName:String):Array<ArrayBuffer>;
|
||||
|
||||
/**
|
||||
Given a `Module`, returns an array containing descriptions of all the declared exports.
|
||||
**/
|
||||
@:pure static function exports(module:Module):Array<ModuleExportDescriptor>;
|
||||
|
||||
/**
|
||||
Given a `Module`, returns an array containing descriptions of all the declared imports.
|
||||
**/
|
||||
@:pure static function imports(module:Module):Array<ModuleImportDescriptor>;
|
||||
}
|
||||
|
||||
typedef ModuleExportDescriptor = {
|
||||
var name:String;
|
||||
var kind:ImportExportKind;
|
||||
}
|
||||
|
||||
typedef ModuleImportDescriptor = {
|
||||
var module:String;
|
||||
var name:String;
|
||||
var kind:ImportExportKind;
|
||||
}
|
||||
|
||||
enum abstract ImportExportKind(String) {
|
||||
var Function = "function";
|
||||
var Table = "table";
|
||||
var Memory = "memory";
|
||||
var Global = "global";
|
||||
}
|
34
Kha/Tools/macos/std/js/lib/webassembly/RuntimeError.hx
Normal file
34
Kha/Tools/macos/std/js/lib/webassembly/RuntimeError.hx
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package js.lib.webassembly;
|
||||
|
||||
/**
|
||||
A WebAssembly `RuntimeError` object is thrown whenever WebAssembly specifies a
|
||||
[trap](http://webassembly.org/docs/semantics/#traps).
|
||||
|
||||
Documentation [RuntimeError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/RuntimeError) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/RuntimeError$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
|
||||
**/
|
||||
@:native("WebAssembly.RuntimeError")
|
||||
extern class RuntimeError extends js.lib.Error {
|
||||
function new(?message:String):Void;
|
||||
}
|
81
Kha/Tools/macos/std/js/lib/webassembly/Table.hx
Normal file
81
Kha/Tools/macos/std/js/lib/webassembly/Table.hx
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package js.lib.webassembly;
|
||||
|
||||
import haxe.Constraints.Function;
|
||||
|
||||
/**
|
||||
A Table object of the given size and element type.
|
||||
|
||||
This is a JavaScript wrapper object — an array-like structure representing a WebAssembly Table,
|
||||
which stores function references. A table created by JavaScript or in WebAssembly code will be
|
||||
accessible and mutable from both JavaScript and WebAssembly.
|
||||
|
||||
Documentation [Table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
|
||||
**/
|
||||
@:native("WebAssembly.Table")
|
||||
extern class Table {
|
||||
/**
|
||||
Returns the length of the table, i.e. the number of elements.
|
||||
**/
|
||||
var length:Int;
|
||||
|
||||
@:pure function new(tableDescriptor:TableDescriptor):Void;
|
||||
|
||||
/**
|
||||
Accessor function — gets the element stored at a given index.
|
||||
**/
|
||||
@:pure function get(index:Int):Function;
|
||||
|
||||
/**
|
||||
Increases the size of the Table instance by a specified number of elements.
|
||||
**/
|
||||
function grow(number:Int):Int;
|
||||
|
||||
/**
|
||||
Sets an element stored at a given index to a given value.
|
||||
**/
|
||||
function set(index:Int, value:Function):Void;
|
||||
}
|
||||
|
||||
typedef TableDescriptor = {
|
||||
/**
|
||||
A string representing the type of value to be stored in the table.
|
||||
At the moment this can only have a value of `Anyfunc` (functions).
|
||||
**/
|
||||
var element:TableKind;
|
||||
|
||||
/**
|
||||
The initial number of elements of the WebAssembly Table.
|
||||
**/
|
||||
var initial:Int;
|
||||
|
||||
/**
|
||||
The maximum number of elements the WebAssembly Table is allowed to grow to.
|
||||
**/
|
||||
var ?maximum:Int;
|
||||
}
|
||||
|
||||
enum abstract TableKind(String) {
|
||||
var Anyfunc = "anyfunc";
|
||||
}
|
Reference in New Issue
Block a user