reload settings on content
This commit is contained in:
parent
d995ab0030
commit
a6b197ca73
3 changed files with 25 additions and 0 deletions
|
@ -19,6 +19,8 @@ export default class BackgroundComponent {
|
|||
});
|
||||
}
|
||||
});
|
||||
browser.tabs.onUpdated.addListener(this.onTabUpdated.bind(this));
|
||||
browser.tabs.onActivated.addListener(this.onTabActivated.bind(this));
|
||||
}
|
||||
|
||||
update() {
|
||||
|
@ -62,4 +64,22 @@ export default class BackgroundComponent {
|
|||
this.store.dispatch(settingsActions.load());
|
||||
}
|
||||
}
|
||||
|
||||
onTabActivated(info) {
|
||||
this.syncSettings(info.tabId);
|
||||
}
|
||||
|
||||
onTabUpdated(id, info) {
|
||||
if (info.url) {
|
||||
this.syncSettings(id);
|
||||
}
|
||||
}
|
||||
|
||||
syncSettings(id) {
|
||||
let { settings } = this.store.getState().setting;
|
||||
return browser.tabs.sendMessage(id, {
|
||||
type: messages.CONTENT_SET_SETTINGS,
|
||||
settings,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue