diff options
Diffstat (limited to 'e2e/ambassador/src/client')
-rw-r--r-- | e2e/ambassador/src/client/ipc.js | 29 | ||||
-rw-r--r-- | e2e/ambassador/src/client/keys.js | 28 | ||||
-rw-r--r-- | e2e/ambassador/src/client/scrolls.js | 20 | ||||
-rw-r--r-- | e2e/ambassador/src/client/tabs.js | 60 | ||||
-rw-r--r-- | e2e/ambassador/src/client/windows.js | 27 |
5 files changed, 0 insertions, 164 deletions
diff --git a/e2e/ambassador/src/client/ipc.js b/e2e/ambassador/src/client/ipc.js deleted file mode 100644 index 9f232ea..0000000 --- a/e2e/ambassador/src/client/ipc.js +++ /dev/null @@ -1,29 +0,0 @@ -import { METHOD_REQUEST, METHOD_RESPONSE } from '../shared/messages'; - -const generateId = () => { - return Math.random().toString(); -}; - -const send = (message) => { - return new Promise((resolve) => { - let id = generateId(); - let callback = (e) => { - let packet = e.data; - if (e.source !== window || packet.method !== METHOD_RESPONSE || - packet.id !== id) { - return; - } - window.removeEventListener('message', callback); - resolve(packet.message); - }; - window.addEventListener('message', callback); - - window.postMessage({ - id, - method: METHOD_REQUEST, - message - }, window.origin); - }); -}; - -export { send }; diff --git a/e2e/ambassador/src/client/keys.js b/e2e/ambassador/src/client/keys.js deleted file mode 100644 index 6b36c23..0000000 --- a/e2e/ambassador/src/client/keys.js +++ /dev/null @@ -1,28 +0,0 @@ -import { EVENT_KEYPRESS, EVENT_KEYDOWN, EVENT_KEYUP } from '../shared/messages'; -import * as ipc from './ipc'; - -const NEUTRAL_MODIFIERS = { shiftKey: false, altKey: false, ctrlKey: false }; - -const press = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => { - return ipc.send({ ...modifiers, - type: EVENT_KEYPRESS, - tabId, - key, }); -}; - -const down = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => { - return ipc.send({ modifiers, - type: EVENT_KEYDOWN, - tabId, - key, }); -}; - - -const up = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => { - return ipc.send({ modifiers, - type: EVENT_KEYUP, - tabId, - key, }); -}; - -export { press, down, up }; diff --git a/e2e/ambassador/src/client/scrolls.js b/e2e/ambassador/src/client/scrolls.js deleted file mode 100644 index f8f82e9..0000000 --- a/e2e/ambassador/src/client/scrolls.js +++ /dev/null @@ -1,20 +0,0 @@ -import { SCROLL_GET, SCROLL_SET } from '../shared/messages'; -import * as ipc from './ipc'; - -const get = (tabId) => { - return ipc.send({ - type: SCROLL_GET, - tabId, - }); -}; - -const set = (tabId, x, y) => { - return ipc.send({ - type: SCROLL_SET, - tabId, - x, - y, - }); -}; - -export { get, set }; diff --git a/e2e/ambassador/src/client/tabs.js b/e2e/ambassador/src/client/tabs.js deleted file mode 100644 index d0cd578..0000000 --- a/e2e/ambassador/src/client/tabs.js +++ /dev/null @@ -1,60 +0,0 @@ -import { - TABS_CREATE, TABS_SELECT_AT, TABS_GET, TABS_UPDATE, TABS_REMOVE, - TABS_GET_ZOOM, TABS_SET_ZOOM, -} from '../shared/messages'; -import * as ipc from './ipc'; - -const create = (windowId, url) => { - return ipc.send({ - type: TABS_CREATE, - windowId, - url, - }); -}; - -const selectAt = (windowId, index) => { - return ipc.send({ - type: TABS_SELECT_AT, - windowId, - index, - }); -}; - -const get = (tabId) => { - return ipc.send({ - type: TABS_GET, - tabId, - }); -}; - -const update = (tabId, properties) => { - return ipc.send({ - type: TABS_UPDATE, - tabId, - properties, - }); -}; - -const remove = (tabId) => { - return ipc.send({ - type: TABS_REMOVE, - tabId - }); -}; - -const getZoom = (tabId) => { - return ipc.send({ - tabId, - type: TABS_GET_ZOOM, - }); -}; - -const setZoom = (tabId, factor) => { - return ipc.send({ - type: TABS_SET_ZOOM, - tabId, - factor, - }); -}; - -export { create, selectAt, get, update, remove, getZoom, setZoom }; diff --git a/e2e/ambassador/src/client/windows.js b/e2e/ambassador/src/client/windows.js deleted file mode 100644 index f92405a..0000000 --- a/e2e/ambassador/src/client/windows.js +++ /dev/null @@ -1,27 +0,0 @@ -import { - WINDOWS_CREATE, WINDOWS_REMOVE, WINDOWS_GET -} from '../shared/messages'; -import * as ipc from './ipc'; - -const create = (url) => { - return ipc.send({ - type: WINDOWS_CREATE, - url, - }); -}; - -const remove = (windowId) => { - return ipc.send({ - type: WINDOWS_REMOVE, - windowId, - }); -}; - -const get = (windowId) => { - return ipc.send({ - type: WINDOWS_GET, - windowId, - }); -}; - -export { create, remove, get }; |