diff --git a/src/index.js b/src/index.js index f673850..90a7c92 100644 --- a/src/index.js +++ b/src/index.js @@ -8,7 +8,7 @@ import IpcAction from './utils/ipc-action'; import GlobalKeyBind from './utils/global-key-bind'; let store = createStore(rootReducer); -new IpcAction(document).subscribe(store); +new IpcAction.subscribe(store); new GlobalKeyBind.subscribe(store); if (process.env.NODE_ENV !== 'production') { diff --git a/src/utils/ipc-action.js b/src/utils/ipc-action.js index 5ea0e2a..a7af053 100644 --- a/src/utils/ipc-action.js +++ b/src/utils/ipc-action.js @@ -4,8 +4,8 @@ import RichState from './rich-state'; import TwitterClient from './twitter-client'; export default class IpcAction { - constructor(document) { - this.document = document; + static subscribe(store) { + new IpcAction().subscribe(store); } subscribe(store) { @@ -18,7 +18,7 @@ export default class IpcAction { store.dispatch(Actions.tweets.setInReplyTo(tweet)); // FIXME: Use better way to focus - this.document.getElementById('tweet_editor').focus(); + document.getElementById('tweet_editor').focus(); }); ipcRenderer.on('invoke-retweet', (event) => {