var msg = {
name: '',
type: 'xhr',
success: function(){},
args: {
url: 'exp.com',
type: 'GET',
dataType: 'html',
success: function(){},
error: function(){console.log('failed')
}
};
chrome.runtime.sendMessage(msg, function(response){
console.log(response);
});
i try to make a callback function, like success: function(){}, error(){}, but is does not work, why ?
when i use
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse){
console.log(message)
});
but can not receive success: function(){}, error:function(){} ?