Merge pull request #6180 from jhen0409/patch-4
Fix chrome.runtime.sendMessage
This commit is contained in:
commit
19d8a366b3
1 changed files with 7 additions and 1 deletions
|
@ -119,7 +119,13 @@ exports.injectTo = function (extensionId, isBackgroundPage, context) {
|
||||||
if (args.length === 1) {
|
if (args.length === 1) {
|
||||||
message = args[0]
|
message = args[0]
|
||||||
} else if (args.length === 2) {
|
} else if (args.length === 2) {
|
||||||
[targetExtensionId, message] = args
|
// A case of not provide extension-id: (message, responseCallback)
|
||||||
|
if (typeof args[1] === 'function') {
|
||||||
|
console.error('responseCallback is not supported')
|
||||||
|
message = args[0]
|
||||||
|
} else {
|
||||||
|
[targetExtensionId, message] = args
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error('options and responseCallback are not supported')
|
console.error('options and responseCallback are not supported')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue