Skip to content

Commit 37f28ae

Browse files
committed
Add documentation
1 parent 11fe684 commit 37f28ae

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

lib/react.ex

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
defmodule React do
2+
@moduledoc """
3+
FFI Module for interacting with the React
4+
JavaScript module.
5+
"""
26
use ElixirScript.FFI
37

8+
@doc """
9+
Creates a React Element
10+
11+
```elixir
12+
props = ElixirScript.JS.map_to_object(%{"hello" => world})
13+
children = []
14+
15+
React.createElement("div", props, children)
16+
```
17+
"""
418
defexternal createElement(type, props, children)
519
end

lib/react_dom.ex

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
defmodule ReactDOM do
2+
@moduledoc """
3+
FFI Module for interacting with the ReactDOM
4+
JavaScript module.
5+
"""
26
use ElixirScript.FFI
37

8+
9+
@doc """
10+
Renders a React Element to the given DOM container
11+
12+
```elixir
13+
ReactDOM.render(my_react_element, "#my_container")
14+
```
15+
16+
Container is any value allowed by [document.querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector)
17+
"""
418
defexternal render(element, container)
519
end

mix.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,19 @@ defmodule ElixirScriptReact.Mixfile do
2222
defp deps do
2323
[
2424
{:elixir_script, "~> 0.30"},
25+
{:ex_doc, "~> 0.16", only: :dev}
2526
]
2627
end
2728

2829
defp description do
2930
"""
30-
React Library for ElixirScript
31+
React library for ElixirScript
3132
"""
3233
end
3334

3435
defp package do
3536
[
36-
files: ["lib", "priv/**/*.*", "mix.exs", "README.md", "LICENSE", "CHANGELOG.md"],
37+
files: ["lib", "priv/**/*.*", "mix.exs", "README.md"],
3738
maintainers: ["Bryan Joseph"],
3839
licenses: ["MIT"],
3940
links: %{

mix.lock

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
%{"elixir_script": {:hex, :elixir_script, "0.30.0", "c67b2d9b6cdfa432717f4bffa3f31f476ff5c5bf15cef59142c6a85e7089d530", [:mix], [{:estree, "~> 2.6", [hex: :estree, repo: "hexpm", optional: false]}], "hexpm"},
1+
%{"earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [], [], "hexpm"},
2+
"elixir_script": {:hex, :elixir_script, "0.30.0", "c67b2d9b6cdfa432717f4bffa3f31f476ff5c5bf15cef59142c6a85e7089d530", [:mix], [{:estree, "~> 2.6", [hex: :estree, repo: "hexpm", optional: false]}], "hexpm"},
23
"estree": {:hex, :estree, "2.6.0", "86a301b0c355fa55c19e7ef9dceb1b1e983c6df526a2b7846818a38c258fc3fb", [], [], "hexpm"},
4+
"ex_doc": {:hex, :ex_doc, "0.16.2", "3b3e210ebcd85a7c76b4e73f85c5640c011d2a0b2f06dcdf5acdb2ae904e5084", [], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
35
"fs": {:hex, :fs, "3.4.0", "6d18575c250b415b3cad559e6f97a4c822516c7bc2c10bfbb2493a8f230f5132", [], [], "hexpm"}}

0 commit comments

Comments
 (0)