plinth/browser/window_proxy

This is a module for Window like objects

Functions such as window.opener return a WindowProxy. This is not part of the inheritance chain of Window. To type the API of window.gleam well proxy needs to be in a separate module, this module.

https://developer.mozilla.org/en-US/docs/Glossary/WindowProxy

Most implementations call into window_ffi.

Types

pub type WindowProxy

Values

pub fn close(proxy: WindowProxy) -> Nil
pub fn on_message(
  worker: WindowProxy,
  handle: fn(event.Event(message_event.T)) -> Nil,
) -> Nil
pub fn post_message(
  proxy: WindowProxy,
  message: json.Json,
  origin: String,
) -> Nil

Post a message to the proxied window. handle messages in the target window by listening for “message” events.

Data is sent in as Json because this is a useful subset for structured clone values

Search Document