本文整理匯總了TypeScript中common/actions.actions.closeTab方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript actions.closeTab方法的具體用法?TypeScript actions.closeTab怎麽用?TypeScript actions.closeTab使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類common/actions.actions
的用法示例。
在下文中一共展示了actions.closeTab方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: async
watcher.on(actions.closeAllTabs, async (store, action) => {
const { window } = action.payload;
const { openTabs } = store.getState().windows[window].navigation;
for (const tab of openTabs) {
store.dispatch(actions.closeTab({ window, tab }));
}
});
示例2: async
watcher.on(actions.closeOtherTabs, async (store, action) => {
const { wind } = action.payload;
const safeTab = action.payload.tab;
const { openTabs } = store.getState().winds[wind].navigation;
for (const tab of openTabs) {
if (tab !== safeTab) {
store.dispatch(actions.closeTab({ wind, tab }));
}
}
});
示例3: closeTabControls
export function closeTabControls(
store: IStore,
window: string,
tab: string
): IMenuTemplate {
// TODO: disable some menu items if last transient tab
return [
{
localizedLabel: ["menu.file.close_tab"],
accelerator: "CmdOrCtrl+W",
action: actions.closeTab({ window, tab }),
},
{
localizedLabel: ["menu.file.close_other_tabs"],
action: actions.closeOtherTabs({ window, tab }),
},
{
localizedLabel: ["menu.file.close_tabs_below"],
action: actions.closeTabsBelow({ window, tab }),
},
];
}