Chrome 61 Beta:JavaScript 模塊,桌面端的支付請求 API,Web Share API 和 WebUSB

原文來自 Chrome 官方博客:Chrome 61 Beta: JavaScript modules, Payment Request API on desktop, Web Share API, and WebUSB
譯者: @justjavacjavascript

除非另有說明,不然下述更改適用於 Android,Chrome OS,Linux,Mac 和 Windows 的最新 Chrome Beta 版本。css

JavaScript 模塊(Modules)

Modules 容許開發人員聲明腳本的依賴關係,這在第三方構建工具中已經很受歡迎,第三方構建工具使用它們用來只打包須要的腳本。此版本經過新的 <script type=module> 元素添加對
JavaScript 模塊的原生支持。html

原生支持意味着瀏覽器能夠並行獲取精細的依賴關係,利用緩存來避免整個頁面中的重複,並確保腳本按照正確的順序執行,而無需構建步驟。前端

進一步閱讀, learn more about JavaScript modulesthe aspects of the JavaScript language affected by modules.java

用於桌面環境的付款請求 API(Payment Request API)

Payment Request API 如今可用於 Windows,Mac,Linux 和 ChromeOS,去年已經支持了 Android 平臺。開發人員如今能夠跨平臺提供安全、無縫的結賬體驗。android

進一步閱讀,integration guidegit

The PaymentRequest process throughout a transaction.

Web Share API

爲了讓用戶輕鬆地在社交網絡上分享內容,開發人員不得不爲每一個社交服務手動將分享按鈕集成到他們的網站中。這一般致使用戶沒法方便的使用訂製的分享服務,而那些包含第三方代碼的頁面無形中增長了代碼大小和安全風險。es6

網站如今能夠在 Chrome for Android 上使用新的 navigator.share API 來觸發本機
Android 共享對話框,容許用戶輕鬆地與任何已安裝的本機應用程序共享文本或連接。在未來的版本中,此 API 也能夠分享到已安裝的 Web 應用程序。github

The navigator.share API allows the user to share content with a variety of native apps via the native Android share dialog.

WebUSB

大多數硬件外設(如鍵盤、鼠標、打印機和遊戲手柄)均受到高級 Web 平臺 API 的支持。要使用專業的教育、科學或工業 USB 外設,用戶必須找到並安裝具備系統級權限的潛在不安全的驅動程序和軟件。web

Chrome 如今支持 WebUSB API,容許網絡應用程序與用戶受權的外設進行通訊。這使得這些設備提供的全部功能都能保持網絡的安全性。

此版本中的其餘功能

  • The Network Information API is now available on desktop as well as Android, enabling sites to access the underlying connection information of a device.

  • Developers can now specify scrolling smoothness via a new optional parameter in existing Scroll APIs or with the scroll-behavior CSS property.

  • The CSSOM View Smooth Scroll API brings native smooth scrolling to the platform through a the scroll-behavior: smooth CSS property or by using the window.scrollTo() DOM scroll method, eliminating the need to implement this behavior with JavaScript

  • CSS color values can now be 8- and 4-digit hex colors of the format #RRGGBBAA and #RGBA.

  • Sites can now access the relative positions of the screen content with the Visual Viewport API, exposing complex functionality like pinch-and-zoom in a more direct way.

  • The Device RAM API is now available, exposing the amount of RAM on a user’s device to sites to optimize overall performance of a web application.

  • When navigating from an installed web app to a site outside the initial web app’s scope, the new site now automatically loads in a Custom Chrome Tab.

  • ...


歡迎關注個人公衆號,關注前端文章:

justjavac微信公衆號

相關文章
相關標籤/搜索