Obtains this page's PAPI MessagePort from main through the preload's bridge.
Installs its message listener BEFORE sending the request, so the reply cannot land before
anyone is listening; that ordering is what lets this skip the onload handshake Electron's
documented pattern needs. Accepts only a message posted by this window itself (the preload posts
from the top window; a web view is a different source) that carries a port, reports the first
outcome, and then stops listening, so nothing that arrives later can be mistaken for the port.
Parameters
Optionalwin: Window
The window whose bridge to use. Defaults to the global window.
Obtains this page's PAPI MessagePort from main through the preload's bridge.
Installs its
messagelistener BEFORE sending the request, so the reply cannot land before anyone is listening; that ordering is what lets this skip theonloadhandshake Electron's documented pattern needs. Accepts only a message posted by this window itself (the preload posts from the top window; a web view is a differentsource) that carries a port, reports the first outcome, and then stops listening, so nothing that arrives later can be mistaken for the port.