本文整理汇总了TypeScript中immutable/contrib/cursor.Cursor.update方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Cursor.update方法的具体用法?TypeScript Cursor.update怎么用?TypeScript Cursor.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类immutable/contrib/cursor.Cursor
的用法示例。
在下文中一共展示了Cursor.update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: undo
public undo(){
if(this.history.size>0){
var i = this.history.size;
this.todos.update(todos=>this.history.last().deref());
this.history = this.history.pop();
}
}
示例2: destroy
public destroy(todo:Cursor) {
this.history = this.history.push(this.todos);
this.todos.update(todos => todos.filter(function(candidate){
return candidate.get('id') !== todo.get('id');
}));
}
示例3: toggleAll
//We use map and filter because React works very well with immutable data. This kind of data is also easier to use and even better than mutating the array.
public toggleAll(checked){
this.history = this.history.push(this.todos);
this.todos.update(value => value.map((todo:any) => {
return todo.set('completed', checked);
}));
}
示例4: clearCompleted
public clearCompleted(){
this.history = this.history.push(this.todos);
this.todos.update(todos => todos.filter(function(todo){
return !todo.get('completed');
}));
}