本文整理匯總了TypeScript中@dojo/stores/state/operations.remove函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript remove函數的具體用法?TypeScript remove怎麽用?TypeScript remove使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了remove函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: get
const removeTagCommand = commandFactory<TagPayload>(({ get, at, path, payload: { tag } }) => {
const tags = get(path('editor', 'tagList'));
const index = tags.indexOf(tag);
if (index !== -1) {
return [remove(at(path('editor', 'tagList'), index))];
}
return [];
});
示例2: get
const deleteCommentCommand = commandFactory<DeleteCommentPayload>(async ({ at, get, path, payload: { slug, id } }) => {
const token = get(path('user', 'token'));
await fetch(`${baseUrl}/articles/${slug}/comments/${id}`, {
method: 'delete',
headers: getHeaders(token)
});
const comments = get(path('article', 'comments'));
let index = -1;
for (let i = 0; i < comments.length; i++) {
if (comments[i].id === id) {
index = i;
break;
}
}
if (index !== -1) {
return [remove(at(path('article', 'comments'), index))];
}
return [];
});
示例3: remove
...keys.filter(key => todos[key].completed).map(key => remove(path('todos', key)))
示例4: commandFactory
const removeTodoCommand = commandFactory(({ payload: { id }, path }): PatchOperation[] => {
return [ remove(path('todos', id)) ];
});