This repository was archived by the owner on Jan 11, 2023. It is now read-only.
Cleanup tabs#5181
Merged
Merged
Conversation
Contributor
bomsy
commented
Jan 24, 2018
- Move part of the items to a util
bomsy
commented
Jan 24, 2018
| items.push({ | ||
| item: { | ||
| ...tabMenuItems.prettyPrint, | ||
| click: () => showSource(tab) |
Contributor
Author
There was a problem hiding this comment.
this should be click: () => togglePrettyPrint(sourceTab.get("id"))
bomsy
commented
Jan 24, 2018
| } | ||
|
|
||
| export function getTabMenuItems() { | ||
| const items = { |
Contributor
There was a problem hiding this comment.
Since it's always the same object you could skip the function and just
export const tabMenuItems = {
...
};
Contributor
|
Sketch of an idea... const handlers = {
closeTab: {
click: () => closeTab(sourceTab.get("url"))
},
// ...
};
const items = {
closeTab: {
id: "node-menu-close-tab",
label: L10N.getStr("sourceTabs.closeTab"),
accesskey: L10N.getStr("sourceTabs.closeTab.accesskey"),
disabled: false
},
// ...
};
function mapTabItems(handlers, items) {
return Object.entries(items).reduce((acc, [key, item]) => {
return [...acc, { item, ...handlers[key] }]
}, []);
} |
Contributor
|
so... frankly i'm okay with a longer menu function. It's cool to try and consolidate it, but lets not add too much indirection in |
jasonLaster
approved these changes
Jan 25, 2018
jasonLaster
pushed a commit
that referenced
this pull request
Jan 29, 2018
* add the tabs reducer * add space * move part of the tab menuitems to the utils * remove abs reducers * fixes * make a function as LION does not exist in the scope of the util
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.