久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為什么在 Electron 項目中需要 Babel

Why is Babel needed in an Electron project(為什么在 Electron 項目中需要 Babel)
本文介紹了為什么在 Electron 項目中需要 Babel的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我對所有 Javascript 生態系統都感到很困惑.我正在嘗試 Electron,這似乎是一種很有前途的創建跨平臺應用程序的方法,它利用了節點和 Chrome 的強大功能.我創建了一個小應用程序并使用了一些現代"(這讓 C# 程序員發笑)javascript 概念作為 lambda,并且它開箱即用(我認為這很自然,因為我有最新版本的節點).然后我嘗試下一步,我在使用 Babel 的示例中看到了很多樣板.

I'm quite confused about all the Javascript ecosystem. I'm trying Electron that seems a promising way in creating cross platform apps, leveraging the power of node and Chrome. I create a small app and used some "modern" ( this make a C# programmer laughing ) javascript concepts as lambdas, and it worked out of the box ( I supposed it was natural, since I've the latest version of node ). Then I'm trying to move next, and I see a lot of boilerplating in the examples using for example Babel.

我為什么需要這個?

如果 electron 在一個最新的、預先知道的、具有最新節點和 chrome 的環境中工作,并且如果我將它捆綁在一個應用程序中,為什么我不應該直接在 ESwhatever 中直接編碼?

If electron works in a up-to date, known in advance, environment with node and chrome up to date, and if I bundle this in a single app, why shouldn't I simply code directly in ESwhatever?

推薦答案

如果你只想要在 electron 中達到 ES7 的功能,你就不需要 Babel.您有兩個進程正在進行主進程和渲染進程.

You don't need Babel if you only want features up to ES7 in electron. You have two processes going on the main process and the render process.

主進程:

  • 使用節點(electron v1.7.x 上的當前節點版本 v7.9.0)
  • 以 99% 的覆蓋率支持 ES6/ES7,但以下情況除外:
    • RegExp.prototype.compile 不返回這個
    • Symbol.toStringTag 不會影響現有的內置函數
    • Array.prototype.values(反正沒人支持)

    渲染過程:

    • 使用 Chromium(當前 Chromium 版本為 58)
    • 支持 ES6 99% 和 ES7 覆蓋率約為 85%,您可以通過 new BrowserWindow({ webPreferences: { experimentalFeatures: true } }) 啟用 experimatal features 標志來增加支持.李>
    • Uses chromium (Current chromium version is 58)
    • Supports ES6 99% and ES7 with ~85% coverage, you can increase the support by enabling the experimatal features flag via new BrowserWindow({ webPreferences: { experimentalFeatures: true } }).

    請注意,我鼓勵您使用與 electron 用于開發的相同版本的節點,這將防止不兼容問題.您可以通過查看電子存儲庫中的 .node-version 文件來檢查這一點.在當前版本中,這將是 v7.9.0.

    Be aware that I would encourage you to use the same version of node that electron uses for development, it will prevent incompatibility issues. you can check this by viewing the .node-version file in the electron repository. At the current version this would be v7.9.0.

    如果你想使用更新的函數,使用 BableJs 仍然是有效的一些操作符,比如擴展操作符 ... 幾乎我所有的項目仍然使用帶有Stage 0"預設的 babel出于這個原因.

    There are still valid points to use BableJs if you want to use even newer functions some operators like the spread operator ... nearly all of my projects still use babel with the 'Stage 0' preset for that reason.

    檢查支持的 ES 規范和方法的一些很好的列表

    Some good lists for checking the supported ES spec and methods

    • Chrome 支持表
    • 節點支持表

    這篇關于為什么在 Electron 項目中需要 Babel的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

    【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進程中創建子窗口時如何修復 BrowserWindow 不是構造函數錯誤) - IT屋-程序員軟件開發技術
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無法在第二個 loadURL 上執行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲?)
How to access camera/webcamera inside electron app?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 美日韩在线视频 | 欧美一区二区三区的 | av毛片在线看 | 国产日韩一区 | 51免费看成人啪啪片 | 日韩精品成人免费观看视频 | 国产欧美日韩综合精品 | 玖玖伊人 | 午夜久久久 | 怡红院久久 | 日韩综合久久 | 亚洲精品久久久久avwww潮水 | 久久精品国产视频 | 中文字字幕在线 | 四虎1515 | 亚洲自拍偷拍一区 | 又大又黄又爽 | 国产日韩欧美一区二区 | 久久久九九 | 日本精品视频 | 清清草视频 | 国内精品视频 | 在线观看免费黄色 | 欧美视频亚洲视频 | 午夜免费视频 | 日本性网站 | 日韩av免费在线观看 | 色人人 | 欧美亚洲三级 | 亚洲黄色三级 | 超碰成人网 | 日韩视频在线观看免费 | 四虎精品视频 | 欧美日韩免费一区二区三区 | 日韩在线视频一区二区三区 | 日本国产一区 | 国产精品三级在线 | 六月丁香激情 | 成人午夜视频在线观看 | 在线免费av网站 | 成人免费网站在线观看 |