电子JS:Windows和Mac之间的开发差异

发布于 2025-02-10 18:13:05 字数 384 浏览 2 评论 0 原文

上下文:

  • 我开始为Windows和Electron JS实现一个用于Windows和Mac的跨平台应用程序。
  • 使用或使用此电子JS应用的捆绑包以角度开发。

我的问题是:

为Windows和Mac开发应用程序时是否存在差异? 例如,在代码级别上处理的差异:

  • 本机菜单。
  • 通知。
  • 系统应用程序事件:最小化,最大化,关闭。
  • 在后台运行该应用。

如果存在差异,我是否应该在代码级别上指示它们,或者电子JS将其转换为每个系统,而我只是开发而不必担心它?

如果我必须在代码级别上注明,我应该有两个项目,还是在同一项目中指出以及何时用于Windows和Mac?

Context:

  • I'm starting to implement a cross-platform app for Windows and Mac with electron Js.
  • The bundle that will use or use this electron Js app is developed in Angular.

My questions are:

Are there differences when developing the app for windows and mac?
Differences in, for example, how it is handled at the code level:

  • Native menus.
  • Notifications.
  • System app events: Minimize, maximize, close.
  • Running the app in background.

If there are differences, should I indicate them at the code level or Electron Js take care of translating this to each system and I just develop generically without worrying about it?

If I have to indicate at the code level, should I have two projects or can I indicate in the same project that and when something is used for Windows and for Mac?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

山色无中 2025-02-17 18:13:05

电子设计为交叉操作系统兼容。

在构建Windows,MacOS或Linux的电子应用之间没有区别。

使用电子API的API 实施本机菜单,通知,系统应用事件(最小化,最大化,关闭)等的使用将确保您的应用程序兼容。

电子模块的某些功能可能仅针对某个操作系统,但是这些特征在电子的 api 。例如:创建新窗口时移动选项noreferrer“>新的browserwindow({movable:true})只能在macOS和窗口上实现,而不是linux。

由于Node.js与电子捆绑在一起,您将需要注意如何实现某些节点函数。例如:目录分离器在操作系统之间将有所不同代码> path.join([... paths]) 将谨慎地使您兼容Cross Os。

由于铬也与电子捆绑在一起,请记住您使用任何特别新的HTML功能。确保您不会尝试使用最前沿的HTML功能,而HTML功能尚未进入您在电子版本中使用的铬版本。

最后,Angular是前端框架,这不会受到所使用的OS类型的影响。

总而言之,设计和编码良好的一个代码库将在Windows,MacOS或Linux上无问题。

Electron is designed to be cross OS compatible.

There should be no difference between building an Electron application for Windows, MacOS or Linux.

Implementing the use of native menus, notifications, system app events (minimize, maximize, close), etc with Electron's API's will ensure your application is cross OS compatible.

Some features of Electron modules may be particular to only a certain OS but these are clearly defined and explained within Electron's Docs and API. EG: The movable option when creating a new window new BrowserWindow({movable: true}) can only be implemented on MacOS and Window, not Linux.

As Node.js is bundled with Electron, you will need to be mindful on how you implement some Node functions. EG: Directory separators will be different between Operating Systems so using methods such as path.join([...paths]) would be prudent to make you code cross OS compatible.

As Chromium is also bundled with Electron, keep in mind your use of any particularly new HTML features. Ensure you are not trying to use cutting edge HTML features which have not made it to the version of Chromium you are using within your version of Electron.

Lastly, Angular is a front end framework, this will not be affected by the type of OS used.

In summary, one code base, designed and coded well, will work without issue on Windows, MacOS or Linux.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文