|
@@ -35,7 +35,7 @@
|
|
|
<h3>API</h3>
|
|
|
<h4>q(atom()) -> term().</h4>
|
|
|
<p>Retrieves from process dictionary by atom-key the value of client DOM element
|
|
|
- passed by over the network as <b>#ev</b> parameter</p>
|
|
|
+ passed by over the network in <b>#ev</b> record as a part of <b>#pickle</b> message.</p>
|
|
|
<figure><code> event(click) -> io:format("~p~n",[nitro:q(:name)]);</code></figure>
|
|
|
<h4>jse([] | binary()) -> [] | binary().</h4>
|
|
|
<p>Performs JavaScript escaping for eval compatibility.</p>
|
|
@@ -87,20 +87,67 @@
|
|
|
> iolist_to_binary(nitro:render(setelement(1,#element{},tag))).
|
|
|
<<"<tag></tag>">></code></figure>
|
|
|
<h4>insert_top(atom(), list(#element{})) -> [].</h4>
|
|
|
+ <p>Wires a JavaScript for adding the NITRO element as a first child of a given DOM id at the client.</p>
|
|
|
+ <figure><code> > nitro:insert_top(panel,#button{}).
|
|
|
+ []
|
|
|
+ > nitro:actions().
|
|
|
+ [#wire{ancestor = action,trigger = [],target = [],
|
|
|
+ module = action_wire,
|
|
|
+ actions = "qi('panel').insertBefore((function(){var div = qn('div');
|
|
|
+ div.innerHTML = '<button type=\"button\"></button>';
|
|
|
+ return div.firstChild; })(),qi('panel').firstChild);",
|
|
|
+ source = []}]
|
|
|
+ > rp(iolist_to_binary(nitro:render(nitro:actions()))).
|
|
|
+ <<"qi('panel').insertBefore((function(){var div
|
|
|
+ = qn('div'); div.innerHTML = '<button type=\"button\"></button>';
|
|
|
+ return div.firstChild; })(),qi('panel').firstChild);">>
|
|
|
+ ok</code></figure>
|
|
|
<h4>insert_bottom(atom(), list(#element{})) -> [].</h4>
|
|
|
+ <p>Wires a JavaScript for adding the NITRO element as a last child of a given DOM id at the client.</p>
|
|
|
+ <figure><code> > nitro:insert_bottom(panel,#button{}).
|
|
|
+ > rp(iolist_to_binary(nitro:render(nitro:actions()))).
|
|
|
+ <<"(function(){ var div = qn('div'); div.innerHTML =
|
|
|
+ '<button type=\"button\"></button>';qi('panel')
|
|
|
+ .appendChild(div.firstChild); })();">>
|
|
|
+ ok</code></figure>
|
|
|
<h4>update(atom(), list(#element{})) -> [].</h4>
|
|
|
+ <p>Wires a JavaScript for updating the DOM element at the client by the render of a given NITRO element.</p>
|
|
|
+ <figure><code> > nitro:update(panel,#button{}).
|
|
|
+ []
|
|
|
+ > rp(iolist_to_binary(nitro:render(nitro:actions()))).
|
|
|
+ <<"qi('panel').outerHTML='<button type=\"button\"<>/button>';">>
|
|
|
+ ok</code></figure>
|
|
|
<h4>clear(atom()) -> [].</h4>
|
|
|
+ <p>Wires a JavaScript that clear at the client all the children of a given DOM element id.</p>
|
|
|
+ <figure><code> > nitro:clear(panel).
|
|
|
+ []
|
|
|
+ > rp(iolist_to_binary(nitro:render(nitro:actions()))).
|
|
|
+ <<"var x = qi('panel'); while (x.firstChild) x.removeChild(x.firstChild);"">>
|
|
|
+ ok</code></figure>
|
|
|
<h4>remove(atom()) -> [].</h4>
|
|
|
- <p>Wires a JavaScript to the process dictionary that manipulate
|
|
|
- DOM elements tree directly on a client side.</p>
|
|
|
+ <p>Wires a JavaScript that remove particular DOM element from the tree at the client.</p>
|
|
|
+ <figure><code> > nitro:remove(panel).
|
|
|
+ []
|
|
|
+ > rp(iolist_to_binary(nitro:render(nitro:actions()))).
|
|
|
+ <<"var x=qi('panel'); x && x.parentNode.removeChild(x);">>
|
|
|
+ ok</code></figure>
|
|
|
<h4>display(atom(),atom()) -> [].</h4>
|
|
|
+ <p>Wires a JavaScript that remove particular DOM element from the tree at the client.</p>
|
|
|
+ <figure><code> > nitro:display(panel,none).
|
|
|
+ []
|
|
|
+ > rp(iolist_to_binary(nitro:render(nitro:actions()))).
|
|
|
+ <<"{ var x = qi('panel'); if (x) x.style.display = 'none'; }">>
|
|
|
+ ok</code></figure>
|
|
|
<p>Wires a JavaScript that manipulate <b>style</b> field of a given DOM element.</p>
|
|
|
<h4>compact(term()) -> binary().</h4>
|
|
|
<p>Pretty-prints the term into more compact format to display by a recursive cut
|
|
|
the tuples with no more that 9 elements width.</p>
|
|
|
<figure><code> > iolist_to_binary(nitro:compact({1,2,3,4,5,{1,2,3,4},7,8,9,10,11})).
|
|
|
- <<"{1,2,3,4,5,{1,2,3,4},7,8,9}">></code></section>
|
|
|
+ <<"{1,2,3,4,5,{1,2,3,4},7,8,9}">></code>
|
|
|
+ <br/>
|
|
|
+ <br/>
|
|
|
</section>
|
|
|
+
|
|
|
</main>
|
|
|
<footer> 2005—2019 © Synrc Research Center </footer>
|
|
|
<script>function drop(){document.getElementById("dropdown").classList.toggle("show");}</script>
|