當兩位用戶更新同一個集合時,流星如何防止競爭狀態?我懷疑它必須與Fibers做些什麼。Meteor的競賽條件
下面的代碼來自待辦事項列表教程。如果兩個用戶同時切換複選框會怎麼樣。流星如何防止競爭狀況。你能指點我在源代碼中的正確位置嗎?
Template.task.events({
'click .toggle-checked'() {
// Set the checked property to the opposite of its current value
Tasks.update(this._id, {
$set: { checked: ! this.checked },
});
},
'click .delete'() {
Tasks.remove(this._id);
},
});