Skip to content

Conversation

@sgithens
Copy link
Member

Adding optional menu item generation to be able to selectively include Capture Tool

@gpii-bot
Copy link

CI job passed: https://ci.gpii.net/job/gpii-app-tests/1194/

* @param {String} label - The label of the item.
* @param {String} event - The event to be triggered on click.
* @param {Object} [payload] - The payload that is to be supplied with the on click event.
* @return {ElectronMenuItem} A simple selectable Electron menu item.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declare that the return is optional - e.g. {ElectronMenuItem|Undefined}

* @return {ElectronMenuItem} A simple selectable Electron menu item.
*/
gpii.app.menu.getOptionalMenuItem = function (hideItem, label, event, payload) {
if (hideItem) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a religious fanatic, but single (and explicit) return-ism is slightly preferable - how about

return hideItem ? undefined : {
            label: label,
            click: event,
            args: payload || {}
        };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants