- commit
- d4dd40c9688844f2792ba60677ad010f3df9f4c9
- parent
- 91dd89b1359a601e3cf06ae3ce070e09f2de50b9
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2019-10-20 12:05
use petit-dom via global object instead of import
Diffstat
| M | index.html | 1 | + |
| M | src/index.js | 5 | ++--- |
| M | src/template.js | 2 | +- |
3 files changed, 4 insertions, 4 deletions
diff --git a/index.html b/index.html
@@ -8,6 +8,7 @@ 8 8 <link rel="stylesheet" type="text/css" href="style.css" /> 9 9 </head> 10 10 <body> -1 11 <script src="node_modules/petit-dom/dist/petit-dom.min.js"></script> 11 12 <script src="index.js"></script> 12 13 </body> 13 14 </html>
diff --git a/src/index.js b/src/index.js
@@ -1,4 +1,3 @@1 -1 const vdom = require('petit-dom/dist/petit-dom.min');2 1 const template = require('./template.js'); 3 2 const logic = require('./logic.js'); 4 3 const constants = require('./constants.js'); @@ -8,13 +7,13 @@ let state, tree; 8 7 const init = function(wrapper) { 9 8 state = {}; 10 9 tree = template(state);11 -1 const element = vdom.mount(tree);-1 10 const element = petitDom.mount(tree); 12 11 wrapper.append(element); 13 12 }; 14 13 15 14 const update = function() { 16 15 const newTree = template(state);17 -1 vdom.patch(newTree, tree);-1 16 petitDom.patch(newTree, tree); 18 17 tree = newTree; 19 18 }; 20 19
diff --git a/src/template.js b/src/template.js
@@ -1,4 +1,4 @@1 -1 const h = require('petit-dom/dist/petit-dom.min').h;-1 1 const h = petitDom.h; 2 2 3 3 const renderBoard = function(state) { 4 4 return h(