R
R
return2014-01-12 20:20:57
JavaScript
return, 2014-01-12 20:20:57

Chrome extension: getBackgroundPage vs sendMessage. Which method is better?

The Chrome Extensions API has several ways to share data from popup to background.
Question in chrome.runtime.getBackgroundPage(...)and chrome.runtime.sendMessage(...). The first allows you to get a link to the windowbackground page, the second - send a message to those who subscribed to events.
As a person who has been writing client-server applications for a long time, I feel asshole that the second method is more correct to use, but I have no proof of this. On the contrary, I understand that sending messages and receiving a response is serialization / deserialization in the json of the request and response, when we receive a link to it when we receive the background page, and this should theoretically be less expensive.
Who knows how it is inside, how right?
Any thoughts?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question