postMessage method

void postMessage(
  1. JSAny? message, [
  2. JSAny? optionsOrTargetOrigin,
  3. JSArray<JSObject>? transfer
])

Calls Window.postMessage on this cross-origin window with the given message, optionsOrTargetOrigin if not null, and transfer if not null.

Implementation

void postMessage(
  JSAny? message, [
  JSAny? optionsOrTargetOrigin,
  JSArray<JSObject>? transfer,
]) {
  if (optionsOrTargetOrigin == null) {
    _window.postMessage(message);
  } else if (transfer == null) {
    _window.postMessage(message, optionsOrTargetOrigin);
  } else {
    _window.postMessage(message, optionsOrTargetOrigin, transfer);
  }
}