cordova-electron
cordova-electron copied to clipboard
Framework functions receive arguments boxed twice in an Array
I'm not sure this is intentional or not, but I don't see the reason for the arguments to be boxed twice in an array when reaching the main process of a framework plugin/element. That is:
-
cordova.exec
transfers the array of argument to_cdvElectronIpc
, which in turns send the array to the main process - the
cdv-plugin-exec
handler uses vararg for the last argument, which basically boxes the argument into another array - the framework function receives a single argument, which is then an array or arrays
Is this intentional?
Hi, I noticed the same as I was working on upgrading an app from cordova-electron 1.x to 3.x
With 1.x I was able to access the main process using the options nodeIntegration = true and contextIsolation = false in browserWindow.webPreferences, but as this is not supported anymore in cordova-electron 3.x, I deep dived into the code to understand how it works and how can I create a plugin that runs in the main process.
I'm going to fork cordova-electron to try to this, and also to call the framework function with parameters (succes, fail, args) to make it more similar to "browser" platform and address the fact that if you have to run the error function, Electron returns a string wrapped in an Error object.