!(function () { var ToDoListModel = BI.inherit(Fix.Model, { state: function () { return { list: [] }; }, watch: {}, computed: { todoList: function () { var items = BI.filter(this.model.list, function (index, item) { return !item.done; }); return BI.map(items, function (index, item) { return BI.extend({ type: "bi.multi_select_item" }, item); }); }, doneList: function () { var items = BI.filter(this.model.list, function (index, item) { return item.done; }); return BI.map(items, function (index, item) { return BI.extend({ type: "bi.multi_select_item", selected: true, disabled: true }, item); }); } }, actions: { addToDo: function (v) { this.model.list.push({ value: BI.UUID(), text: v, done: false }); }, finish: function (v) { BI.some(this.model.list, function (index, item) { if (item.value === v) { item.done = true; } }); } } }); BI.model("my.model.todolist", ToDoListModel); })();