Comments (4)
You are right, this way of providing callbacks is not supported. But you can provide the callback as a separate argument, like this:
var data = { foo: 'foo' };
var callback = function() { ... };
application.remote.test(data, callback);
In this case the callback is preserved and can be invoked from the other side.
But if an argument is not a function, but an object, it is serialized, and all the functions are thrown away.
Would it work for you, if you provide the callback as a separate argument? Or do you think that the callbacks should be extracted from the objects for some reason?
from jailed.
Thank for your attention,
I could put the callback in the function arguments, but there are several events I have to deal with, that means some callbacks that can be possiblely passed to the function. And that can grows as the application grows and the function signature would become very complex.
The second easy way would be to use an object returned by the function, with some callback setter, but as you state in the doc, remote function dont return anything.
I probably can workarround it, but that would be awesome if I could use functions as config values in an object !
Do you think that can be safely supported by jailed ?
from jailed.
Do you think that can be safely supported by jailed ?
This sounds like possible, but far too complex and over-designed. Currently I have a feeling that your case can be solved in a clean way using the existing capabilities of jailed. Then I would maybe update the docs somehow to explain such a case.
Returned values are ignored due to the fact that exported methods are invoked asynchronously. But you can give a callback which will process the result as an argument, this should be pretty similar, as long as you need to pass the data as a result.
Next there are two more options:
- Instead of invoking the given callback, you can provide a string identifier for an event happened, and handle it respectively on the other side;
- You can export all possible event type handlers during the initialization, so that instead of invoking the provided callback, application would invoke the respective method exported from the plugin side.
Would it work?
from jailed.
Well, that will make things more complex to write and to use but I can deal with it! Once documented that would be ok.
Thank you!
from jailed.
Related Issues (20)
- unable to find application object
- Dom manipulation in jailed HOT 1
- Write code without application.remote HOT 2
- Just tried the base example - Getting permission issue HOT 5
- Why is the Web Worker inside an iframe? HOT 4
- Exposing values from the app to the jailed worker. HOT 1
- Best way to pass large data set into jailed script (browser)?
- Cannot read property 'whenEmitted' of undefined
- Add setting for "fallback to iframe jailing only" functionality, and timeout value
- Improve Jail Isolation via Content-Security-Policy HOT 1
- CVE-2022-23923 HOT 2
- Pass values to jailed code HOT 2
- Passing interface with sub functions not working
- Sandbox Escape Bug in jailed with Node.js
- Sandbox Escape Bug in jailed with Node.js
- Sandbox Escape in jailed with Node.js
- Sandbox Escape Bug in jailed with Node.js
- Sandbox Escape Bug in jailed with Node.js
- Sandbox Escape Bug in jailed with Node.js
- Sandbox Escape Bug in jailed with Node.js
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jailed.