You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "teh-mICON (via GitHub)" <gi...@apache.org> on 2023/01/22 01:39:02 UTC

[GitHub] [cordova-electron] teh-mICON opened a new pull request, #247: Added possibility for multiple plugin results

teh-mICON opened a new pull request, #247:
URL: https://github.com/apache/cordova-electron/pull/247

   <!--
   Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines:
   
   http://cordova.apache.org/contribute/contribute_guidelines.html
   
   Thanks!
   -->
   
   ### Platforms affected
   electron
   browser (?)
   
   
   ### Motivation and Context
   <!-- Why is this change required? What problem does it solve? -->
   <!-- If it fixes an open issue, please link to the issue here. -->
   It is currently not possible to send more than one plugin response per service action call. This is not ideal in situations where a native process might generate more than one result over time.
   Additionally, the API is more in line with that of cordova-android and from what I can gather also cordova-ios
   
   
   
   ### Description
   <!-- Describe your changes in detail -->
   The version in this branch creates a callbackId in exec.js and passes it on to preload.
   preload registers this callbackId with ipcRenderer and invokes the callback.
   main creates a CallbackContext with this callbackId and passes it on to the service action dispatch
   service actions now have a similar API as android: (action: string, args: any, callbackContext: Object)
   
   [callbackContext]https://github.com/teh-mICON/cordova-electron/blob/4.0.x/bin/templates/platform_www/CallbackContext.js#L21) provides functions `success` and `error`.
   Additionally, it exposes the `PluginResult` class along with `sendPluginResult`. This makes it possible to send multiple results when keepCallback is set to true.
   There might be a better way to provide this API to plugins.
   
   
   
   
   ### Testing
   <!-- Please describe in detail how you tested your changes. -->
   I used document.addEventListener in the [plugin sample](https://github.com/teh-mICON/cordova-electron/blob/4.0.x/tests/spec/fixtures/test-app-with-electron-plugin/plugins/cordova-plugin-sample/www/init.js) to call [a demo implementation of the new api]((https://github.com/teh-mICON/cordova-electron/blob/4.0.x/tests/spec/fixtures/test-app-with-electron-plugin/plugins/cordova-plugin-sample/src/electron/index.js)
   
   
   
   ### Checklist
   
   - [ ] I've run the tests to see all new and existing tests pass
   - [ ] I added automated test coverage as appropriate for this change
   - [x] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`)
   - [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
   - [x] I've updated the documentation if necessary
   
   Unfortunately I can't check any of these. I wasn't sure how the tests were supposed to be run but I created a sample app that tests for the functionality.
   
   ### Additional notes
   - The API changes would break existing plugins but it would be a new major version so depending on the maintainer's opinions that might be ok?
   If not, there is always the option to load the plugin package.json and check for an API flag.
   - I couldn't get the browser fallback to work so couldn't test for that.
   - Strictly speaking it applies to both electron and browser so the check is alright in that box I guess
   - I didn't find any documentation that applies


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-electron] codecov-commenter commented on pull request #247: Added possibility for multiple plugin results

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #247:
URL: https://github.com/apache/cordova-electron/pull/247#issuecomment-1399504595

   # [Codecov](https://codecov.io/gh/apache/cordova-electron/pull/247?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#247](https://codecov.io/gh/apache/cordova-electron/pull/247?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (198cf24) into [master](https://codecov.io/gh/apache/cordova-electron/commit/7053f35efdfc7f4195cf215998ec9fad4796f432?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7053f35) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   ```diff
   @@            Coverage Diff            @@
   ##            master      #247   +/-   ##
   =========================================
     Coverage   100.00%   100.00%           
   =========================================
     Files           14        14           
     Lines          656       656           
   =========================================
     Hits           656       656           
   ```
   
   
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org