@@ -3,20 +3,20 @@ defmodule ElixirScript.FFI do
33 The foreign function interface for interacting with JavaScript
44
55 To define a foreign module, make a new module and add `use ElixirScript.FFI`. to it
6- To define foreign functions, use the `foreign ` macro.
6+ To define external functions, use the `defexternal ` macro.
77
88 Here is an example of a foreign module for a JSON module
99
1010 ```elixir
1111 defmodule MyApp.JSON do
1212 use ElixirScript.FFI
1313
14- foreign stringify(map)
15- foreign parse(string)
14+ defexternal stringify(map)
15+ defexternal parse(string)
1616 end
1717 ```
1818
19- Foreign modules map to JavaScript files that export functions defined with the `foreign ` macro.
19+ Foreign modules map to JavaScript files that export functions defined with the `defexternal ` macro.
2020 ElixirScript expects JavaScript modules to be in the `priv/elixir_script` directory.
2121 These modules are copied to the output directory upon compilation.
2222
@@ -46,13 +46,13 @@ defmodule ElixirScript.FFI do
4646 @ doc """
4747 Defines a JavaScript function to be called from Elixir modules
4848
49- To define a foreign function, pass the name and arguments to `foreign `
49+ To define an external function, pass the name and arguments to `defexternal `
5050
5151 ```elixir
52- foreign my_js_function(arg1, arg2, arg3)
52+ defexternal my_js_function(arg1, arg2, arg3)
5353 ```
5454 """
55- defmacro foreign ( { name , _ , args } ) do
55+ defmacro defexternal ( { name , _ , args } ) do
5656 args = Enum . map ( args , fn
5757 { :\\ , meta0 , [ { name , meta , atom } , value ] } ->
5858 name = String . to_atom ( "_" <> Atom . to_string ( name ) )
0 commit comments