я пытаюсь получить ответ от SendResponse к chrome.runtime.sendMessage, но его всегда с указанием неопределен, ниже мой код:Не получая ответа Chrome расширение,
chrome.runtime.sendMessage(JSON.stringify(contact), function(response) {
console.log('Response: ', response); // This is showing undefined
});
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
contact.addContact(request, function() {
sendResponse({success: 'true'});
});
});
Так что, когда я прохожу SendResponse ({успех : true}), который должен быть получен в обратном вызове на chrome.runtime.sendMessage, но вместо этого его показ не определен.
Да, сработало, спасибо большое ... :) –