aboutsummaryrefslogtreecommitdiff
path: root/e2e/ambassador/src/client/ipc.js
diff options
context:
space:
mode:
Diffstat (limited to 'e2e/ambassador/src/client/ipc.js')
-rw-r--r--e2e/ambassador/src/client/ipc.js29
1 files changed, 0 insertions, 29 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 };