browser_action/src/actions.js
/**

detectSite()
------------

This action asks the observer for the current site, and changes it in the store.
The observer gets the current site from the adapter, via adapter.site.

**/
detectSite()
This action asks the observer for the current site, and changes it in the store.
The observer gets the current site from the adapter, via adapter.site.
detectSite () This action asks the observer for the current site and changes it in the store . The observer gets the current site from the adapter via adapter . site .
function detectSite() {
  return function (dispatch) {
    return new Promise((resolve, _) => {
      sendMessageToActiveTab({
        type: 'detect-site'
      }).then(response => {
        if (response.ok) {
          dispatch({
            type: 'CHANGE_DETECTED_SITE',
            payload: response.site
          });
        }
        resolve();
      }).catch(err => {
        console.log(`actions: Couldn't detect site.`);
        resolve();
      });
    });
  }
}
function detectSite ( ) { return function ( dispatch ) { return new Promise ( ( resolve , _ ) => { sendMessageToActiveTab ( { type : 'detect-site' } ) . then ( response => { if ( response . ok ) { dispatch ( { type : 'CHANGE_DETECTED_SITE' , payload : response . site } ) ; } resolve ( ) ; } ) . catch ( err => { console . log ( ` ` ) ; resolve ( ) ; } ) ; } ) ; } }
detectSite()
This action asks the observer for the current site, and changes it in the store.
detectSite () This action asks the observer for the current site and changes it in the store .