Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Return menuId and throws error for non support properties #85

Merged
merged 1 commit into from
Nov 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions atom/common/api/resources/context_menus_bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ var binding = {
create: function (properties, cb) {
var responseId = createResponseId()
var menuItemId = properties.id || createMenuItemId()
if (properties.checked !== undefined) {
throw new Error('createProperties.checked of contextMenus.create is not supported yet')
}
if (properties.documentUrlPatterns !== undefined) {
throw new Error('createProperties.documentUrlPatterns of contextMenus.create is not supported yet')
}
if (properties.targetUrlPatterns !== undefined) {
throw new Error('createProperties.targetUrlPatterns of contextMenus.create is not supported yet')
}
if (properties.enabled !== undefined) {
throw new Error('createProperties.enabled of contextMenus.create is not supported yet')
}
cb && ipc.once('chrome-context-menus-create-response-' + responseId, function(evt) {
cb()
})
Expand All @@ -43,6 +55,7 @@ var binding = {
}
})
ipc.send('chrome-context-menus-create', responseId, extensionId, menuItemId, properties)
return menuItemId
}
}

Expand Down