DEV Community

Discussion on: Use Javascript Proxy for isolated context intercommunication

Collapse
 
mqklin profile image
mqklin

Why do you need a proxy here? I believe you could do exactly the same without proxy: function processData(inputData) would return a promise that does sendMessage and resolves with a response from backend.

Collapse
 
clementvidal profile image
ClementVidal

Hell @mqklin , you say:
"return a promise that does sendMessage and resolves with a response from backend"
That's exactly what this code is doing, but instead of explicitly writing the piece of code that will do that in processData or any methods that need to be used that way, it do that for you, on your behalf so you don't have to care about it.

Does it answer your question?