wilton/esm
Export Wilton API as a ES module.
More...
This module allows client code to import Wilton as a ES module.
All Wilton API is exported as a single wilton
variable, that must be imported first and then can be desctructured to access separate "submodules". These submodules (and their corresponding native libraries) are loaded lazily.
When ES modules are used as callbackScript
s to be invoked (possibly in another thread) from native code, they must be specified using full path (including protocol prefix) to JS file in esmodule
attribute. Arguments can be provided to such callbackScript
s using args
attribute, but only String
, Integer
and Boolean
arguments are supported. Arguments can be accessed from ES module using import.meta.args
. func
attribute is not supported for ES modules.
Usage example: