Merge pull request #129 from ueokande/retry-setting-load
fix plugin load
This commit is contained in:
commit
516a701ebb
4 changed files with 9 additions and 2 deletions
|
@ -35,6 +35,7 @@
|
||||||
"multiline-ternary": "off",
|
"multiline-ternary": "off",
|
||||||
"newline-after-var": "off",
|
"newline-after-var": "off",
|
||||||
"newline-before-return": "off",
|
"newline-before-return": "off",
|
||||||
|
"newline-per-chained-call": "off",
|
||||||
"no-bitwise": "off",
|
"no-bitwise": "off",
|
||||||
"no-console": ["error", { "allow": ["warn", "error"] }],
|
"no-console": ["error", { "allow": ["warn", "error"] }],
|
||||||
"no-empty-function": "off",
|
"no-empty-function": "off",
|
||||||
|
|
|
@ -32,6 +32,10 @@ export default class Common {
|
||||||
type: messages.SETTINGS_QUERY,
|
type: messages.SETTINGS_QUERY,
|
||||||
}).then((settings) => {
|
}).then((settings) => {
|
||||||
this.store.dispatch(settingActions.set(settings));
|
this.store.dispatch(settingActions.set(settings));
|
||||||
|
}).catch((e) => {
|
||||||
|
// Sometime sendMessage fails when background script is not ready.
|
||||||
|
console.warn(e);
|
||||||
|
setTimeout(() => this.reloadSettings(), 500);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import actions from 'content/actions';
|
import actions from 'content/actions';
|
||||||
|
|
||||||
const defaultState = {};
|
const defaultState = {
|
||||||
|
keymaps: {},
|
||||||
|
};
|
||||||
|
|
||||||
export default function reducer(state = defaultState, action = {}) {
|
export default function reducer(state = defaultState, action = {}) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import settingReducer from 'content/reducers/setting';
|
||||||
describe("content setting reducer", () => {
|
describe("content setting reducer", () => {
|
||||||
it('return the initial state', () => {
|
it('return the initial state', () => {
|
||||||
let state = settingReducer(undefined, {});
|
let state = settingReducer(undefined, {});
|
||||||
expect(state).to.deep.equal({});
|
expect(state).to.deep.equal({ keymaps: {} });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('return next state for SETTING_SET', () => {
|
it('return next state for SETTING_SET', () => {
|
||||||
|
|
Reference in a new issue