You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Foreign Function Interface for JavaScript interoperability #317
Will need to make an ElixirScript.FFI module. This module will contain a foreign macro for defining functions to call in a JavaScript module.
The corresponding JavaScript modules must be placed in priv/elixir_script/. The convention will be that for each . in a module name, this corresponds to a folder level.
An Example, I want to interop with JavaScript in order to use JSON functions. I would make a module like so
If my code calls functions on MyApp.JSON, priv/elixir_script/my_app/json.js will be copied to the output folder. In our bundled output file, there will be an import statement added to include the JavaScript module above. All calls to MyApp.JSON will be translated to calls to the JavaScript module.
Note: Will need to reach into different app's priv folder. This can be done with :code.priv_dir(app). Can get the current app's name with Mix.Project.config()[:app]. Can get dependency app names with Mix.Project.deps_paths()
Activity