本文整理汇总了TypeScript中mobx.values函数的典型用法代码示例。如果您正苦于以下问题:TypeScript values函数的具体用法?TypeScript values怎么用?TypeScript values使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了values函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: deleteGroup
export function deleteGroup(group: Partial<IGroup>) {
beginTransaction("Delete shortcuts group");
store.deleteObject(group);
values(shortcuts)
.filter(shortcut => shortcut.groupName === group.name)
.forEach(shortcut => shortcutsStore.deleteObject(shortcut));
commitTransaction();
}
示例2: autorun
autorun(() => {
Mousetrap.reset();
values(instumentShortcuts.get()).forEach(shortcut => {
if (shortcut.keybinding) {
Mousetrap.bind(shortcut.keybinding, () => {
executeShortcut(shortcut);
return false;
});
}
});
});
示例3: deleteGroupInShortcuts
export function deleteGroupInShortcuts(groupName: string) {
db.prepare(`DELETE FROM "${store.storeName}" WHERE groupName = ?`).run(groupName);
let changedShortcuts = values(shortcuts)
.filter(shortcut => shortcut.groupName === groupName)
.map(shortcut => ({ id: shortcut.id }));
sendMessage(store.notifySource, {
op: "delete",
object: changedShortcuts
});
}
示例4: updateGroup
export function updateGroup(changes: Partial<IGroup>) {
beginTransaction("Edit shortcuts group");
if (changes.name) {
const group = groups.get(changes.id!);
if (group && group.name != changes.name) {
values(shortcuts)
.filter(shortcut => shortcut.groupName === group.name)
.forEach(shortcut =>
shortcutsStore.updateObject({
id: shortcut.id,
groupName: changes.name
})
);
}
}
store.updateObject(changes);
commitTransaction();
}
示例5: computed
export const instrumentExtensions = computed(() => {
return values(extensions)
.filter(extension => extension.type === "instrument")
.sort((a, b) => stringCompare(a.displayName || a.name, b.displayName || b.name));
});
示例6: all
.views(self => {
return {
get all() {
return mobxValues(self.items)
}
}
})