Skip to content

Commit dbc6c05

Browse files
committed
Refactor API
1 parent d7089e4 commit dbc6c05

File tree

6 files changed

+8
-9
lines changed

6 files changed

+8
-9
lines changed
File renamed without changes.
File renamed without changes.

src/browser/extension/utils/contentScriptMsg.js renamed to src/app/api/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export function generateId(instanceId) {
1717
return instanceId || Math.random().toString(36).substr(2);
1818
}
1919

20-
2120
function tryCatch(fn, args) {
2221
try {
2322
return fn(args);
@@ -27,17 +26,17 @@ function tryCatch(fn, args) {
2726
}
2827
}
2928

30-
function send(message) {
29+
function post(message) {
3130
window.postMessage(message, '*');
3231
}
3332

3433
export function toContentScript(message, shouldStringify, serializeState, serializeAction) {
3534
if (shouldStringify || isCircular) {
3635
if (message.payload) message.payload = stringify(message.payload, serializeState);
3736
if (message.action) message.action = stringify(message.action, serializeAction);
38-
send(message);
37+
post(message);
3938
} else {
40-
tryCatch(send, message);
39+
tryCatch(post, message);
4140
}
4241
}
4342

File renamed without changes.
File renamed without changes.

src/browser/extension/inject/pageScript.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import createStore from '../../../app/store/createStore';
22
import configureStore from '../../../app/store/configureStore';
33
import { isAllowed } from '../options/syncOptions';
44
import Monitor from '../../../app/service/Monitor';
5-
import { getLocalFilter, isFiltered, filterState } from '../utils/filters';
6-
import notifyErrors from '../utils/notifyErrors';
7-
import importState from '../utils/importState';
8-
import openWindow from '../utils/openWindow';
5+
import { getLocalFilter, isFiltered, filterState } from '../../../app/api/filters';
6+
import notifyErrors from '../../../app/api/notifyErrors';
7+
import importState from '../../../app/api/importState';
8+
import openWindow from '../../../app/api/openWindow';
99
import {
1010
updateStore, toContentScript, sendMessage, setListener, connect, disconnect, generateId
11-
} from '../utils/contentScriptMsg';
11+
} from '../../../app/api';
1212

1313
let stores = {};
1414

0 commit comments

Comments
 (0)