-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
36 lines (30 loc) · 933 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// webpack-to-do-app
// Imports
import { dna } from 'dna-engine';
import '../css/app.css';
// Application
const todo = {
add() {
// Creates a new task.
const titleElem = globalThis.document.getElementById('task-title');
const task = {
title: titleElem.value,
done: false,
};
dna.clone('task', task, { fade: true });
console.log(dna.getModels('task')); //display array of tasks in the js console
},
setup() {
// Creates initial default task.
const titleElem = globalThis.document.getElementById('task-title');
titleElem.value = 'Launch 🚀';
const task = {
title: 'Check out: 🧬 dna-engine.org',
done: false,
};
dna.clone('task', task);
},
};
// Initialization
dna.registerContext('todo', todo); //expose application functions to be callbacks from web page
dna.dom.onReady(todo.setup);