Access External Javascript Libraries Using Haxe
Solution 1:
The Extern mechanism assumes that the defined types exist at runtime (they are available to be invoked/used) but assumes nothing about how and where those types are defined. This is true for all the platforms.
How the extern libraries are included in your project mostly depends on the target and can vary greatly.
In the case of JS, there is not a direct association between the extern definitions (.hx files) and the JS that includes those types (js library). The haxe files should be accessible by haxe (using -cp
, -lib
, or putting them in your source directory) while the js files should be accessible by the runtime (include the lib JS in your HTML before the haxe generated code).
What might create some confusion is that Haxe supports a feature that allows you to embed an external js file inside the generated code. This way you can distribute only one file instead of a main file + one or more lib files. You can have a look at how Haxe automatically includes JQuery in __init__()
.
Post a Comment for "Access External Javascript Libraries Using Haxe"