From 6594841b1d1f082107bdb1489f02d3c99cff8ffa Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Wed, 4 Oct 2017 21:30:57 +0900 Subject: use createStore short-hand method --- src/pages/settings.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/pages/settings.js') diff --git a/src/pages/settings.js b/src/pages/settings.js index 9bad967..076d23d 100644 --- a/src/pages/settings.js +++ b/src/pages/settings.js @@ -1,15 +1,15 @@ import './settings.scss'; import SettingComponent from '../components/setting'; import settingReducer from '../reducers/setting'; -import * as store from '../store'; +import { createStore } from '../store'; -const settingStore = store.createStore(settingReducer); +const store = createStore(settingReducer); let settingComponent = null; -settingStore.subscribe(() => { +store.subscribe(() => { settingComponent.update(); }); document.addEventListener('DOMContentLoaded', () => { - settingComponent = new SettingComponent(document.body, settingStore); + settingComponent = new SettingComponent(document.body, store); }); -- cgit v1.2.3 From 32168a94e07478325a53779513533b76a6ef2c18 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Thu, 5 Oct 2017 20:14:58 +0900 Subject: fix imports in src --- src/actions/command.js | 4 ++-- src/actions/completion.js | 2 +- src/actions/console.js | 2 +- src/actions/follow.js | 2 +- src/actions/input.js | 2 +- src/actions/operation.js | 8 ++++---- src/actions/setting.js | 6 +++--- src/background/index.js | 14 +++++++------- src/components/background-input.js | 4 ++-- src/components/background.js | 12 ++++++------ src/components/console.js | 4 ++-- src/components/content-input.js | 2 +- src/components/follow.js | 8 ++++---- src/components/setting.js | 4 ++-- src/content/index.js | 16 ++++++++-------- src/pages/console.js | 12 ++++++------ src/pages/settings.js | 6 +++--- src/reducers/completion.js | 2 +- src/reducers/console.js | 2 +- src/reducers/follow.js | 2 +- src/reducers/index.js | 10 +++++----- src/reducers/input.js | 2 +- src/reducers/setting.js | 2 +- src/shared/validators/setting.js | 2 +- webpack.config.js | 2 +- 25 files changed, 66 insertions(+), 66 deletions(-) (limited to 'src/pages/settings.js') diff --git a/src/actions/command.js b/src/actions/command.js index f578afd..a40cc97 100644 --- a/src/actions/command.js +++ b/src/actions/command.js @@ -1,5 +1,5 @@ -import * as tabs from '../background/tabs'; -import * as histories from '../background/histories'; +import * as tabs from 'background/tabs'; +import * as histories from 'background/histories'; import * as consoleActions from './console'; const normalizeUrl = (string, searchConfig) => { diff --git a/src/actions/completion.js b/src/actions/completion.js index 1ffb025..733f516 100644 --- a/src/actions/completion.js +++ b/src/actions/completion.js @@ -1,4 +1,4 @@ -import actions from '../actions'; +import actions from 'actions'; const setItems = (groups) => { return { diff --git a/src/actions/console.js b/src/actions/console.js index e0ec631..ba1fbeb 100644 --- a/src/actions/console.js +++ b/src/actions/console.js @@ -1,4 +1,4 @@ -import actions from '../actions'; +import actions from 'actions'; const showCommand = (text) => { return { diff --git a/src/actions/follow.js b/src/actions/follow.js index 7ab689e..708cd95 100644 --- a/src/actions/follow.js +++ b/src/actions/follow.js @@ -1,4 +1,4 @@ -import actions from '../actions'; +import actions from 'actions'; const enable = (newTab) => { return { diff --git a/src/actions/input.js b/src/actions/input.js index 67788dd..61acb76 100644 --- a/src/actions/input.js +++ b/src/actions/input.js @@ -1,4 +1,4 @@ -import actions from '../actions'; +import actions from 'actions'; const asKeymapChars = (key, ctrl) => { if (ctrl) { diff --git a/src/actions/operation.js b/src/actions/operation.js index 3ed7f05..97bcf45 100644 --- a/src/actions/operation.js +++ b/src/actions/operation.js @@ -1,8 +1,8 @@ -import operations from '../shared/operations'; -import messages from '../content/messages'; +import operations from 'shared/operations'; +import messages from 'content/messages'; import * as consoleActions from './console'; -import * as tabs from '../background/tabs'; -import * as zooms from '../background/zooms'; +import * as tabs from 'background/tabs'; +import * as zooms from 'background/zooms'; const exec = (operation, tab) => { switch (operation.type) { diff --git a/src/actions/setting.js b/src/actions/setting.js index 7898f06..2a47608 100644 --- a/src/actions/setting.js +++ b/src/actions/setting.js @@ -1,6 +1,6 @@ -import actions from '../actions'; -import messages from '../content/messages'; -import DefaultSettings from '../shared/default-settings'; +import actions from 'actions'; +import messages from 'content/messages'; +import DefaultSettings from 'shared/default-settings'; const load = () => { return browser.storage.local.get('settings').then((value) => { diff --git a/src/background/index.js b/src/background/index.js index 9a1adc6..8dc55cb 100644 --- a/src/background/index.js +++ b/src/background/index.js @@ -1,10 +1,10 @@ -import * as consoleActions from '../actions/console'; -import * as settingsActions from '../actions/setting'; -import BackgroundComponent from '../components/background'; -import BackgroundInputComponent from '../components/background-input'; -import reducers from '../reducers'; -import messages from '../content/messages'; -import { createStore } from '../store'; +import * as consoleActions from 'actions/console'; +import * as settingsActions from 'actions/setting'; +import BackgroundComponent from 'components/background'; +import BackgroundInputComponent from 'components/background-input'; +import reducers from 'reducers'; +import messages from 'content/messages'; +import { createStore } from 'store'; const store = createStore(reducers, (e, sender) => { console.error('Vim-Vixen:', e); diff --git a/src/components/background-input.js b/src/components/background-input.js index 4735d5a..bd6ecf9 100644 --- a/src/components/background-input.js +++ b/src/components/background-input.js @@ -1,5 +1,5 @@ -import * as inputActions from '../actions/input'; -import * as operationActions from '../actions/operation'; +import * as inputActions from 'actions/input'; +import * as operationActions from 'actions/operation'; export default class BackgroundInputComponent { constructor(store) { diff --git a/src/components/background.js b/src/components/background.js index 0585a04..08d5115 100644 --- a/src/components/background.js +++ b/src/components/background.js @@ -1,9 +1,9 @@ -import messages from '../content/messages'; -import * as commandActions from '../actions/command'; -import * as consoleActions from '../actions/console'; -import * as inputActions from '../actions/input'; -import * as settingsActions from '../actions/setting'; -import * as tabActions from '../actions/tab'; +import messages from 'content/messages'; +import * as commandActions from 'actions/command'; +import * as consoleActions from 'actions/console'; +import * as inputActions from 'actions/input'; +import * as settingsActions from 'actions/setting'; +import * as tabActions from 'actions/tab'; export default class BackgroundComponent { constructor(store) { diff --git a/src/components/console.js b/src/components/console.js index 9580dcf..25b135c 100644 --- a/src/components/console.js +++ b/src/components/console.js @@ -1,5 +1,5 @@ -import messages from '../content/messages'; -import * as completionActions from '../actions/completion'; +import messages from 'content/messages'; +import * as completionActions from 'actions/completion'; export default class ConsoleComponent { constructor(wrapper, store) { diff --git a/src/components/content-input.js b/src/components/content-input.js index 10c785b..38d57fd 100644 --- a/src/components/content-input.js +++ b/src/components/content-input.js @@ -1,4 +1,4 @@ -import messages from '../content/messages'; +import messages from 'content/messages'; export default class ContentInputComponent { constructor(target) { diff --git a/src/components/follow.js b/src/components/follow.js index d2d3902..9221759 100644 --- a/src/components/follow.js +++ b/src/components/follow.js @@ -1,7 +1,7 @@ -import * as followActions from '../actions/follow'; -import messages from '../content/messages'; -import Hint from '../content/hint'; -import HintKeyProducer from '../content/hint-key-producer'; +import * as followActions from 'actions/follow'; +import messages from 'content/messages'; +import Hint from 'content/hint'; +import HintKeyProducer from 'content/hint-key-producer'; const DEFAULT_HINT_CHARSET = 'abcdefghijklmnopqrstuvwxyz'; diff --git a/src/components/setting.js b/src/components/setting.js index 1f3b3fe..c2f99b6 100644 --- a/src/components/setting.js +++ b/src/components/setting.js @@ -1,5 +1,5 @@ -import * as settingActions from '../actions/setting'; -import { validate } from '../shared/validators/setting'; +import * as settingActions from 'actions/setting'; +import { validate } from 'shared/validators/setting'; export default class SettingComponent { constructor(wrapper, store) { diff --git a/src/content/index.js b/src/content/index.js index a9a50be..31b37cf 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -1,13 +1,13 @@ import './console-frame.scss'; import * as consoleFrames from './console-frames'; -import * as scrolls from '../content/scrolls'; -import * as navigates from '../content/navigates'; -import * as followActions from '../actions/follow'; -import { createStore } from '../store'; -import ContentInputComponent from '../components/content-input'; -import FollowComponent from '../components/follow'; -import reducers from '../reducers'; -import operations from '../shared/operations'; +import * as scrolls from 'content/scrolls'; +import * as navigates from 'content/navigates'; +import * as followActions from 'actions/follow'; +import { createStore } from 'store'; +import ContentInputComponent from 'components/content-input'; +import FollowComponent from 'components/follow'; +import reducers from 'reducers'; +import operations from 'shared/operations'; import messages from './messages'; const store = createStore(reducers); diff --git a/src/pages/console.js b/src/pages/console.js index 0e152d3..a4536ec 100644 --- a/src/pages/console.js +++ b/src/pages/console.js @@ -1,10 +1,10 @@ import './console.scss'; -import messages from '../content/messages'; -import CompletionComponent from '../components/completion'; -import ConsoleComponent from '../components/console'; -import reducers from '../reducers'; -import { createStore } from '../store'; -import * as completionActions from '../actions/completion'; +import messages from 'content/messages'; +import CompletionComponent from 'components/completion'; +import ConsoleComponent from 'components/console'; +import reducers from 'reducers'; +import { createStore } from 'store'; +import * as completionActions from 'actions/completion'; const store = createStore(reducers); let completionComponent = null; diff --git a/src/pages/settings.js b/src/pages/settings.js index 076d23d..6e25e6f 100644 --- a/src/pages/settings.js +++ b/src/pages/settings.js @@ -1,7 +1,7 @@ import './settings.scss'; -import SettingComponent from '../components/setting'; -import settingReducer from '../reducers/setting'; -import { createStore } from '../store'; +import SettingComponent from 'components/setting'; +import settingReducer from 'reducers/setting'; +import { createStore } from 'store'; const store = createStore(settingReducer); let settingComponent = null; diff --git a/src/reducers/completion.js b/src/reducers/completion.js index 878aeac..f85a500 100644 --- a/src/reducers/completion.js +++ b/src/reducers/completion.js @@ -1,4 +1,4 @@ -import actions from '../actions'; +import actions from 'actions'; const defaultState = { groupSelection: -1, diff --git a/src/reducers/console.js b/src/reducers/console.js index 5c49c3b..3e63672 100644 --- a/src/reducers/console.js +++ b/src/reducers/console.js @@ -1,4 +1,4 @@ -import actions from '../actions'; +import actions from 'actions'; const defaultState = { errorShown: false, diff --git a/src/reducers/follow.js b/src/reducers/follow.js index 136b367..a2397b4 100644 --- a/src/reducers/follow.js +++ b/src/reducers/follow.js @@ -1,4 +1,4 @@ -import actions from '../actions'; +import actions from 'actions'; const defaultState = { enabled: false, diff --git a/src/reducers/index.js b/src/reducers/index.js index db17edf..5a4f14b 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -1,8 +1,8 @@ -import inputReducer from '../reducers/input'; -import consoleReducer from '../reducers/console'; -import settingReducer from '../reducers/setting'; -import followReducer from '../reducers/follow'; -import completionReducer from '../reducers/completion'; +import inputReducer from 'reducers/input'; +import consoleReducer from 'reducers/console'; +import settingReducer from 'reducers/setting'; +import followReducer from 'reducers/follow'; +import completionReducer from 'reducers/completion'; const defaultState = { input: inputReducer(undefined, {}), diff --git a/src/reducers/input.js b/src/reducers/input.js index 8be701e..2e4bcd8 100644 --- a/src/reducers/input.js +++ b/src/reducers/input.js @@ -1,4 +1,4 @@ -import actions from '../actions'; +import actions from 'actions'; const defaultState = { keys: '', diff --git a/src/reducers/setting.js b/src/reducers/setting.js index 735d4fb..7326ed7 100644 --- a/src/reducers/setting.js +++ b/src/reducers/setting.js @@ -1,4 +1,4 @@ -import actions from '../actions'; +import actions from 'actions'; const defaultState = { settings: {} diff --git a/src/shared/validators/setting.js b/src/shared/validators/setting.js index 4dc35ff..5039ec2 100644 --- a/src/shared/validators/setting.js +++ b/src/shared/validators/setting.js @@ -1,4 +1,4 @@ -import operations from '../operations'; +import operations from 'shared/operations'; const VALID_TOP_KEYS = ['keymaps', 'search']; const VALID_OPERATION_VALUES = Object.keys(operations).map((key) => { diff --git a/webpack.config.js b/webpack.config.js index e4d5a17..3d4ef03 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -40,7 +40,7 @@ module.exports = { resolve: { extensions: [ '.js' ], - modules: [path.join(__dirname), 'node_modules'] + modules: [path.join(__dirname, 'src'), 'node_modules'] }, plugins: [ -- cgit v1.2.3