本文整理匯總了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)
}
}
})