aboutsummaryrefslogtreecommitdiff
path: root/src/background/components/tab.js
blob: 6af3fd70e6157f5117220337d08e580c70c76bf0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import * as tabActions from '../actions/tab';

export default class TabComponent {
  constructor(store) {
    this.store = store;

    browser.tabs.onActivated.addListener(async(info) => {
      await browser.tabs.query({ currentWindow: true });
      return this.onTabActivated(info);
    });
  }

  onTabActivated(info) {
    return this.store.dispatch(tabActions.selected(info.tabId));
  }
}