Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 7859d77

Browse files
committed
update readme example
1 parent 3b02eb4 commit 7859d77

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

README.md

+17-13
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,27 @@ const view = ({ item }) =>
3535
Compiles to:
3636

3737
```jsx
38+
import { insert as _$insert } from "dom";
39+
import { wrap as _$wrap } from "dom";
40+
3841
const _tmpl$ = document.createElement("template");
3942
_tmpl$.innerHTML = "<tr><td class='col-md-1'></td><td class='col-md-4'><a></a></td><td class='col-md-1'><a><span class='glyphicon glyphicon-remove' aria-hidden='true'></span></a></td><td class='col-md-6'></td></tr>";
43+
4044
const view = ({ item }) =>
41-
function() {
45+
function () {
4246
const _el$ = _tmpl$.content.firstChild.cloneNode(true),
43-
_el$2 = _el$.firstChild,
44-
_el$3 = _el$2.nextSibling,
45-
_el$4 = _el$3.firstChild,
46-
_el$5 = _el$3.nextSibling,
47-
_el$6 = _el$5.firstChild;
48-
r.wrap(() => _el$.className = item.id === selected ? 'danger' : '');
49-
r.insert(_el$2, item.id);
50-
_el$4.onclick = e => select(item, e));
51-
r.insert(_el$4, () => item.label);
52-
_el$6.onclick = e => del(item, e));
47+
_el$2 = _el$.firstChild,
48+
_el$3 = _el$2.nextSibling,
49+
_el$4 = _el$3.firstChild,
50+
_el$5 = _el$3.nextSibling,
51+
_el$6 = _el$5.firstChild;
52+
_$wrap(() => _el$.className = item.id === selected ? 'danger' : '');
53+
_$insert(_el$2, item.id);
54+
_el$4.onclick = e => select(item, e);
55+
_$insert(_el$4, () => item.label);
56+
_el$6.onclick = e => del(item, e);
5357
return _el$;
54-
}()
58+
}();
5559
```
5660
The use of cloneNode improves repeat insert performance and precompilation reduces the number of references to the minimal traversal path. This is a basic example which doesn't leverage event delegation or any of the more advanced features described below.
5761

@@ -63,7 +67,7 @@ The use of cloneNode improves repeat insert performance and precompilation reduc
6367
## Plugin Options
6468

6569
### moduleName
66-
The name of the runtime the compiler will output. Defaults to 'r'.
70+
The name of the runtime module to import the methods from. Required.
6771

6872
### delegateEvents
6973
Boolean to indicate whether to enable automatic event delegation on camelCase.

0 commit comments

Comments
 (0)