本文整理汇总了TypeScript中satcheljs.action函数的典型用法代码示例。如果您正苦于以下问题:TypeScript action函数的具体用法?TypeScript action怎么用?TypeScript action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了action函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: updateItem
import { action } from 'satcheljs';
import Store from '../store/store';
let updateItem =
function updateItem(id: string, text: string) {
let items = Store.items.filter(item => item.id == id);
if (items.length == 1) {
let item = items[0];
item.text = text;
}
};
export default action("updateItem")(updateItem);
开发者ID:Microsoft,项目名称:satcheljs-todomvc,代码行数:13,代码来源:updateItem.ts
示例2: updateEditItemValue
import { action } from 'satcheljs';
import Store from '../store/store';
let updateEditItemValue =
function updateEditItemValue(text: string) {
Store.editItemText = text;
};
export default action("updateEditItemValue")(updateEditItemValue);
开发者ID:Microsoft,项目名称:satcheljs-todomvc,代码行数:9,代码来源:updateEditItemValue.ts
示例3: updateTextboxValue
import { action } from 'satcheljs';
import Store from '../store/store';
let updateTextboxValue =
function updateTextboxValue(text: string) {
Store.textboxValue = text;
};
export default action("updateTextboxValue")(updateTextboxValue);
开发者ID:Microsoft,项目名称:satcheljs-todomvc,代码行数:9,代码来源:updateTextboxValue.ts
示例4: toggleCompleted
import { action } from 'satcheljs';
import Store from '../store/store';
let toggleCompleted =
function toggleCompleted(id: string) {
let items = Store.items.filter(item => item.id == id);
items[0].completed = !items[0].completed;
Store.itemsLeft = Store.itemsLeft + (items[0].completed ? -1 : 1);
};
export default action("toggleCompleted")(toggleCompleted);
开发者ID:Microsoft,项目名称:satcheljs-todomvc,代码行数:12,代码来源:toggleCompleted.ts
示例5: toggleEditItem
import { action } from 'satcheljs';
import Store from '../store/store';
let toggleEditItem =
function toggleEditItem(id: string) {
if (Store.editItemId != id && id) {
let items = Store.items.filter(item => item.id == id);
Store.editItemId = id;
Store.editItemText = items[0].text;
} else {
Store.editItemId = null;
}
};
export default action("toggleEditItem")(toggleEditItem);
开发者ID:Microsoft,项目名称:satcheljs-todomvc,代码行数:15,代码来源:toggleEditItem.ts
示例6: removeAllCompleted
import { action } from 'satcheljs';
import Store from '../store/store';
let removeAllCompleted =
function removeAllCompleted() {
let index = 0;
let items = Store.items;
let numberOfSplicedItems = 0;
if (items.length > 0) {
let item = items[0];
while (item != null) {
if (item.completed) {
items.splice(index, 1);
numberOfSplicedItems++;
} else {
index++;
}
item = items[index];
}
}
};
export default action("removeAllCompleted")(removeAllCompleted);
开发者ID:Microsoft,项目名称:satcheljs-todomvc,代码行数:26,代码来源:removeAllCompleted.ts
注:本文中的satcheljs.action函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论