Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
todos[0].completed = true;
// Prints: 'Completed 1 of 2 todo items'
export function addTodo(title) {
todos.push(mobservable.fromJson({
title: title,
completed: false
}));
}
export function removeTodo(todo) {
todos.splice(todos.indexOf(todo), 1);
}
/** How to do something async: */
mobservable.props(todos, { isLoading: 0 });
export function loadTodosAsync() {
todos.isLoading++;
// mimic something asynchronous
setTimeout(function() {
addTodo("Asynchronously created todo");
addTodo("Another asynchronously created todo");
todos.isLoading--;
}, 2000);
}