Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking: improve support for plugins code running in main, fixing quirks of 3.x, and making it more coherent with Cordova APIs #239

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jul 6, 2022

  1. Improved ipcMain.handle handler and ipcRenderer.invoke callbacks for …

    …cdv-plugin-exec
    
    The main goal was to allow passing to the error callback an unaltered copy of the argument, as with the previous implementation you have to throw an exception or return a rejected promise, and this is forwarded to the ipcRenderer.invoke as a string encapsulated in an Error object. See electron/electron#24427
    
    Moreover, with the previous implementation, args for the action were encapsulated twice in an Array ( see apache#214 ). To make it more coherent with Cordova standards, and to allow backward support easily with a simple check, the first and the second arguments are success and error functions, and the third argument is the args array. So if the first argument is a function, we are using this cordova-electron~4 proposal, otherwise we are using cordova-electron~3, and it is the "arguments" array.
    
    Finally, _cdvElectronIPC.exec checks if success and error parameters are actually functions before calling them, in order to avoid annoying error log messages if they were not defined.
    fabiofabbri84 committed Jul 6, 2022
    Configuration menu
    Copy the full SHA
    445dc6f View commit details
    Browse the repository at this point in the history