Skip to content

Commit

Permalink
Worker: Catch apollo proxy message
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Feb 1, 2019
1 parent bf1e92c commit 0ecd298
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/middlewares/debuggerAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ const onWindowMessage = e => {
const { data } = e;
if (data && data.source === APOLLO_PROXY) {
const message = typeof data.payload === 'string' ? { event: data.payload } : data.payload;
worker.postMessage({ source: APOLLO_PROXY, ...message });
worker.postMessage({
method: 'emitApolloMessage',
source: APOLLO_PROXY,
...message,
});
}
};

Expand Down
4 changes: 4 additions & 0 deletions app/worker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ const messageHandlers = {
// pass to other listeners
return true;
},
emitApolloMessage() {
// pass to other listeners
return true;
},
invokeDevMenuMethod({ name, args }) {
invokeDevMenuMethodIfAvailable(name, args);
return false;
Expand Down

0 comments on commit 0ecd298

Please sign in to comment.