如何创建针对电子平台的 cordova 插件?
How do I create a cordova plugin targeting electron platform?
我有一个混合应用程序,我正在尝试将其转换为桌面应用程序,添加电子平台以及 android 和 ios。
Cordova 似乎支持 Electron 平台,只需执行 cordova platform add electron
它就可以创建一个包含 webapp 的 window,但没有插件挂钩。
由于插件最初是为 iOS 和 Android 编写的,我想用 NodeJS 重写它们,但我很难找到任何相关文档。在 cordova documentation 我可以阅读:
When adding a plugin, if the plugin supports both the electron and browser platform, the electron portion will be used. If the plugin misses electron but contains the browser implementation, it will fall back on the browser implementation.
但是我怎么知道一个插件是否支持电子平台呢?如果只在文档的“平台”部分提及,其他开发人员如何知道如何使插件与 Electron 兼容?
那么,很快,我该如何为 cordova 设置 electron 插件?
Cordova 的 Electron 插件实际上是“浏览器”平台插件
All browser-based plugins are usable with the Electron platform.
When adding a plugin, if the plugin supports both the electron and
browser platform, the electron portion will be used. If the plugin
misses electron but contains the browser implementation, it will fall
back on the browser implementation.
https://www.electronjs.org/docs/faq#i-can-not-use-jqueryrequirejsmeteorangularjs-in-electron
在此处阅读有关浏览器平台的信息
https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#platform
我不同意其他人所说的 cordova-electron 只是一个浏览器。
文档说的是,如果没有提供特定于电子的插件,则会回退到浏览器实现。
这里是如何 link 原生 C++ 到纯电子应用程序。
https://gauriatiq.medium.com/electron-app-with-c-back-end-as-native-addon-napi-c67867f4058
考虑到这一点,我们只需要找到一种方法让插件可以使用它。
虽然这只会 运行 在能够 运行 本机 c++ 的机器上,但您可以想象有一种方法可以使特定于平台的插件在 electron 保护伞下工作。
我有一个混合应用程序,我正在尝试将其转换为桌面应用程序,添加电子平台以及 android 和 ios。
Cordova 似乎支持 Electron 平台,只需执行 cordova platform add electron
它就可以创建一个包含 webapp 的 window,但没有插件挂钩。
由于插件最初是为 iOS 和 Android 编写的,我想用 NodeJS 重写它们,但我很难找到任何相关文档。在 cordova documentation 我可以阅读:
When adding a plugin, if the plugin supports both the electron and browser platform, the electron portion will be used. If the plugin misses electron but contains the browser implementation, it will fall back on the browser implementation.
但是我怎么知道一个插件是否支持电子平台呢?如果只在文档的“平台”部分提及,其他开发人员如何知道如何使插件与 Electron 兼容?
那么,很快,我该如何为 cordova 设置 electron 插件?
Cordova 的 Electron 插件实际上是“浏览器”平台插件
All browser-based plugins are usable with the Electron platform.
When adding a plugin, if the plugin supports both the electron and browser platform, the electron portion will be used. If the plugin misses electron but contains the browser implementation, it will fall back on the browser implementation.
https://www.electronjs.org/docs/faq#i-can-not-use-jqueryrequirejsmeteorangularjs-in-electron
在此处阅读有关浏览器平台的信息
https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#platform
我不同意其他人所说的 cordova-electron 只是一个浏览器。 文档说的是,如果没有提供特定于电子的插件,则会回退到浏览器实现。
这里是如何 link 原生 C++ 到纯电子应用程序。 https://gauriatiq.medium.com/electron-app-with-c-back-end-as-native-addon-napi-c67867f4058
考虑到这一点,我们只需要找到一种方法让插件可以使用它。
虽然这只会 运行 在能够 运行 本机 c++ 的机器上,但您可以想象有一种方法可以使特定于平台的插件在 electron 保护伞下工作。