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

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

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

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