本文へジャンプ

Electron 25.0.0

·5分間の読書

Electron 25.0.0がリリースされました!Chromium 114、V8 11.4、Node.js 18.15.0へのアップグレードが含まれています。詳細については以下をお読みください!


Electronチームは、Electron 25.0.0のリリースを発表できることを嬉しく思います!npm install electron@latestでnpmを使用してインストールするか、当社のリリースウェブサイトからダウンロードできます。このリリースの詳細については、読み進めてください。

フィードバックがありましたら、Twitterで共有するか、コミュニティのDiscordに参加してください!バグや機能のリクエストは、Electronのイシュートラッカーで報告できます。

注目すべき変更点

ハイライト

  • Chromiumのネットワーキングスタックを使用して、Electronのnetモジュール内にnet.fetchを実装しました。これは、Node.jsのHTTPスタックを使用するNodeのfetch()とは異なります。#36733#36606を参照してください。
  • protocol.{register,intercept}{String,Buffer,Stream,Http,File}Protocolを置き換え、非推奨とするprotocol.handleを追加しました。#36674
  • ChromiumとMicrosoftのWindows 7/8/8.1廃止計画に合わせるため、Electron 22のサポートを延長しました。このブログ投稿の最後に追加の詳細があります。

スタックの変更

破壊的変更

非推奨: protocol.{register,intercept}{Buffer,String,Stream,File,Http}Protocol

protocol.register*Protocolメソッドとprotocol.intercept*Protocolメソッドは、protocol.handleに置き換えられました。

新しいメソッドは、新しいプロトコルの登録または既存のプロトコルの傍受のいずれかを実行でき、応答は任意のタイプにすることができます。

// Deprecated in Electron 25
protocol.registerBufferProtocol('some-protocol', () => {
callback({ mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>') });
});

// Replace with
protocol.handle('some-protocol', () => {
return new Response(
Buffer.from('<h5>Response</h5>'), // Could also be a string or ReadableStream.
{ headers: { 'content-type': 'text/html' } }
);
});
// Deprecated in Electron 25
protocol.registerHttpProtocol('some-protocol', () => {
callback({ url: 'https://electron.dokyumento.jp' });
});

// Replace with
protocol.handle('some-protocol', () => {
return net.fetch('https://electron.dokyumento.jp');
});
// Deprecated in Electron 25
protocol.registerFileProtocol('some-protocol', () => {
callback({ filePath: '/path/to/my/file' });
});

// Replace with
protocol.handle('some-protocol', () => {
return net.fetch('file:///path/to/my/file');
});

非推奨: BrowserWindow.setTrafficLightPosition(position)

BrowserWindow.setTrafficLightPosition(position)は非推奨となりました。代わりにBrowserWindow.setWindowButtonPosition(position) APIを使用する必要があります。これは、位置をシステムデフォルトにリセットするためにnullを受け入れます。

// Deprecated in Electron 25
win.setTrafficLightPosition({ x: 10, y: 10 });
win.setTrafficLightPosition({ x: 0, y: 0 });

// Replace with
win.setWindowButtonPosition({ x: 10, y: 10 });
win.setWindowButtonPosition(null);

非推奨: BrowserWindow.getTrafficLightPosition()

BrowserWindow.getTrafficLightPosition()は非推奨となりました。代わりにBrowserWindow.getWindowButtonPosition() APIを使用する必要があります。これは、カスタム位置がない場合にnullを返します。

// Deprecated in Electron 25
const pos = win.getTrafficLightPosition();
if (pos.x === 0 && pos.y === 0) {
// No custom position.
}

// Replace with
const ret = win.getWindowButtonPosition();
if (ret === null) {
// No custom position.
}

新機能

  • net.fetch()を追加しました。#36733
    • net.fetchは、file: URLとprotocol.register*Protocolで登録されたカスタムプロトコルへのリクエストをサポートします。#36606
  • BrowserWindow.set/getWindowButtonPosition APIを追加しました。#37094
  • protocol.{register,intercept}{String,Buffer,Stream,Http,File}Protocolを置き換え、非推奨とするprotocol.handleを追加しました。#36674
  • フレーム階層内の任意のフレームがナビゲートを試行するたびに発火するwill-frame-navigateイベントをwebContentsおよび<webview>タグに追加しました。#34418
  • ナビゲーターイベントに開始者の情報を追加しました。この情報は、子によって開始されたナビゲーションとは対照的に、親フレームによって発生したナビゲーションをwindow.openと区別することを可能にします。#37085
  • デフォルトのsessionオブジェクトを使用してホストを解決するnet.resolveHostを追加しました。#38152
  • 新しい'did-resign-active'イベントをappに追加しました。#38018
  • webContents.print()にいくつかの標準的なページサイズオプションを追加しました。#37159
  • リモートオーディオ入力を、audioWebFrameMainである場合にローカル出力ストリームにエコーさせることを許可するための、セッションハンドラses.setDisplayMediaRequestHandler()コールバックにenableLocalEchoフラグを追加しました。#37315
  • powerMonitorに熱管理情報が追加されました。#38028
  • session.fromPath() APIに絶対パスを渡せるようになりました。#37604
  • webContentsaudio-state-changedイベントを公開しました。#37366

22.x.y継続サポート

Windows 7/8/8.1サポート終了のお知らせ」で述べられている通り、Electron 22(Chromium 108)の予定されていたサポート終了日は、2023年5月30日から2023年10月10日に延長されました。Electronチームは、2023年10月10日まで、このプログラムの一部であるセキュリティ修正をElectron 22にバックポートし続けます。10月のサポート終了日は、ChromiumとMicrosoftの延長サポート期間に準拠したものです。10月11日以降、Electronチームは最新の3つの安定版メジャーバージョンへのサポートに限定し、Windows 7/8/8.1のサポートは終了します。

E25 (2023年5月)E26 (2023年8月)E27 (2023年10月)
25.x.y26.x.y27.x.y
24.x.y25.x.y26.x.y
23.x.y24.x.y25.x.y
22.x.y22.x.y--

今後の予定

短期的な展望としては、Chromium、Node.js、V8を含む、Electronを構成する主要コンポーネントの開発を継続することに重点を置いていきます。

Electronのパブリックタイムラインはこちらをご覧ください。

今後の変更に関する詳細は、予定されている破壊的変更ページをご覧ください。