shared/scripts/contentscript.js
/**
 * Allows communication between content script and background script.
 *
 * @param {Object} body - the message payload.
 */
Allows communication between content script and background script.
@param {Object} body - the message payload.
Allows communication between content script and background script . @param { Object } body - the message payload .
function postMessage(body) {
  body = JSON.stringify(body);
  if (environment === 'chrome') {
    chrome.runtime.sendMessage(body);
  }
  else if (environment === 'firefox') {
    self.port.emit('contentScript', body);
  }
}
function postMessage ( body ) { body = JSON . stringify ( body ) ; if ( environment === 'chrome' ) { chrome . runtime . sendMessage ( body ) ; } else if ( environment === 'firefox' ) { self . port . emit ( 'contentScript' , body ) ; } }
Allows communication between content script and background script.
Allows communication between content script and background script .