window.app = {
taskList: {
path: "app>task-list",
value: [
{id: 1, name: "do stuff"},
{id: 2, name: "take a nap"}
],
template: ""
}
}
(function(scope){
scope.getProgress = function () {
return this.taskList.value.filter((task) => task.done).length / this.taskList.value.length
}
})(window.app)
div@app
ul
{{taskList}}
li
[[id]].[[name]]
div
{{getProgress()}}