You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm sure I'm missing something obvious, but how do I go about passing an object of key / value pairs to the jailed code?
For example, if I had something like:
{
firstName: John,
lastName: Doe
}
How would I go about accessing firstName and lastName within plugin.js? My original guess was that I'd add the object to the 2nd property of jailed.Plugin(pathToPlugin, { scope: { firstName: 'John', lastName: 'Doe' } }) but it didn't work.
I looked at the web-banner example in the repo, but the bad / good image names are hardcoded into plugin.js. I need those values to be dynamic.
The text was updated successfully, but these errors were encountered:
I'm using the dynamic plugin so YMMV but what I do is have my script export a function called run that then the host calls. Something like this:
import{DynamicPluginassandbox}from'jailed'constboilerplate=` application.setInterface({ // Function called by app to start script run: async (data, done) => { .... script to run .... done() } })`constprocess=newsandbox(boilerplate,callbacks)returnnewPromise(resolve=>{process.whenConnected(()=>{process.remote.run({ ...datatopass.... },resolve)})})
You could also just serialize the data and embed in your dynamic script.
I'm sure I'm missing something obvious, but how do I go about passing an object of key / value pairs to the jailed code?
For example, if I had something like:
How would I go about accessing
firstName
andlastName
withinplugin.js
? My original guess was that I'd add the object to the 2nd property ofjailed.Plugin(pathToPlugin, { scope: { firstName: 'John', lastName: 'Doe' } })
but it didn't work.I looked at the web-banner example in the repo, but the bad / good image names are hardcoded into
plugin.js
. I need those values to be dynamic.The text was updated successfully, but these errors were encountered: