onupdate.js
/**
* Inject proper CSS and sends the appropriate command to
* the receiver instanciated by the `devruler.js` script.
* @param {object} tab involved, from storage settings
* @param {string} id of the tab
*/
Inject proper CSS and sends the appropriate command to
the receiver instanciated by the `devruler.js` script.
Inject proper CSS and sends the appropriate command to the receiver instanciated by the ` devruler . js ` script .
function updateOnLoad(tab, id) {
  if (tab.state) {
    browser.tabs.insertCSS({file: '/css/ruler.css'}).then(() => {
      browser.tabs.sendMessage(id, {
        command: "showRuler"
      }).catch(onError);
    });
  } else {
    browser.tabs.removeCSS({file: '/css/ruler.css'}).then(() => {
      browser.tabs.sendMessage(id, {
        command: "resetRuler",
      }).catch(onError);
    });
  }
  if (tab.bsbState) {
    browser.tabs.insertCSS({file: '/css/breakpoints.css'}).then(() => {
      browser.tabs.sendMessage(id, {
        command: "showBreakpoints"
      }).catch(onError);
    });
  } else {
    browser.tabs.removeCSS({file: '/css/breakpoints.css'}).then(() => {
      browser.tabs.sendMessage(id, {
        command: "resetBreakpoints",
      }).catch(onError);
    });
  }
  if (tab.state || tab.bsbState) {
    browser.tabs.sendMessage(id, {
      command: "updateStyles",
    }).catch(onError);
  }
}
function updateOnLoad ( tab , id ) { if ( tab . state ) { browser . tabs . insertCSS ( { file : '/css/ruler.css' } ) . then ( ( ) => { browser . tabs . sendMessage ( id , { command : "showRuler" } ) . catch ( onError ) ; } ) ; } else { browser . tabs . removeCSS ( { file : '/css/ruler.css' } ) . then ( ( ) => { browser . tabs . sendMessage ( id , { command : "resetRuler" , } ) . catch ( onError ) ; } ) ; } if ( tab . bsbState ) { browser . tabs . insertCSS ( { file : '/css/breakpoints.css' } ) . then ( ( ) => { browser . tabs . sendMessage ( id , { command : "showBreakpoints" } ) . catch ( onError ) ; } ) ; } else { browser . tabs . removeCSS ( { file : '/css/breakpoints.css' } ) . then ( ( ) => { browser . tabs . sendMessage ( id , { command : "resetBreakpoints" , } ) . catch ( onError ) ; } ) ; } if ( tab . state || tab . bsbState ) { browser . tabs . sendMessage ( id , { command : "updateStyles" , } ) . catch ( onError ) ; } }
Inject proper CSS and sends the appropriate command to
the receiver instanciated by the `devruler.js` script.
Inject proper CSS and sends the appropriate command to the receiver instanciated by the ` devruler . js ` script .