Window
Types
t
type t = DomTypes.windowwindowPostMessageOptions
type windowPostMessageOptions = DomTypes.windowPostMessageOptionsRecord fields
transfer
targetOrigin
Values
addEventListener
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. Read more on MDN
let addEventListener: ( t, EventTypes.eventType, EventTypes.eventListener<'event>, ~options: EventTypes.addEventListenerOptions=?,) => unitParameters
t EventTypes.eventType EventTypes.eventListener option< EventTypes.addEventListenerOptions >Return type
unitaddEventListenerWithCapture
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. Read more on MDN
let addEventListenerWithCapture: ( t, EventTypes.eventType, EventTypes.eventListener<'event>,) => unitalert
let alert: (t, ~message: string=?) => unitasEventTarget
let asEventTarget: t => EventTypes.eventTargetcaches
let caches: t => WebWorkersTypes.cacheStoragecancelAnimationFrame
let cancelAnimationFrame: (t, int) => unitcancelIdleCallback
let cancelIdleCallback: (t, int) => unitclearInterval
let clearInterval: (t, int) => unitclearTimeout
Cancels the execution of a timeout created with setTimeout.
let clearTimeout: (t, DomTypes.timeoutId) => unitclosed
Returns true if the window has been closed, false otherwise. Read more on MDN
let closed: t => boolconfirm
let confirm: (t, ~message: string=?) => boolcrossOriginIsolated
let crossOriginIsolated: t => boolcrypto
let crypto: t => WebCryptoTypes.cryptocurrent
let current: tcustomElements
Defines a new custom element, mapping the given name to the given constructor as an autonomous custom element. Read more on MDN
let customElements: t => DomTypes.customElementRegistrydispatchEvent
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. Read more on MDN
let dispatchEvent: (t, EventTypes.event) => booldocument
let document: t => DomTypes.documentfocus
Moves the focus to the window's browsing context, if any. Read more on MDN
let focus: t => unitframeElement
let frameElement: t => Null.t<DomTypes.element>getComputedStyle
let getComputedStyle: ( t, ~elt: DomTypes.element, ~pseudoElt: string=?,) => DomTypes.cssStyleDeclarationgetSelection
let getSelection: t => null<DomTypes.selection>history
let history: t => HistoryTypes.historyindexedDB
let indexedDB: t => IndexedDbTypes.idbFactorylocalStorage
let localStorage: t => WebStorageTypes.storagelocation
let location: t => DomTypes.locationlocationbar
Returns true if the location bar is visible; otherwise, returns false. Read more on MDN
let locationbar: t => DomTypes.barPropmatchMedia
let matchMedia: (t, string) => DomTypes.mediaQueryListmenubar
Returns true if the menu bar is visible; otherwise, returns false. Read more on MDN
let menubar: t => DomTypes.barPropmoveBy
let moveBy: (t, ~x: int, ~y: int) => unitmoveTo
let moveTo: (t, ~x: int, ~y: int) => unitnavigator
let navigator: t => DomTypes.navigatoropen_
let open_: ( t, ~url: string=?, ~target: string=?, ~features: string=?,) => tparent
Refers to either the parent WindowProxy, or itself.
It can rarely be null e.g. for contentWindow of an iframe that is already removed from the parent. Read more on MDN
let parent: t => tperformance
let performance: t => PerformanceTypes.performancepersonalbar
Returns true if the personal bar is visible; otherwise, returns false. Read more on MDN
let personalbar: t => DomTypes.barProppostMessage
Posts a message to the given window. Messages can be structured objects, e.g. nested objects and arrays, can contain JavaScript values (strings, numbers, Date objects, etc), and can contain certain data objects such as WebApiFile Blob, FileList, and ArrayBuffer objects.
Objects listed in the transfer member of options are transferred, not just cloned, meaning that they are no longer usable on the sending side.
A target origin can be specified using the targetOrigin member of options. If not provided, it defaults to "/". This default restricts the message to same-origin targets only.
If the origin of the target window doesn't match the given target origin, the message is discarded, to avoid information leakage. To send the message to the target regardless of origin, set the target origin to "*".
Throws a "DataCloneError" DOMException if transfer array contains duplicate objects or if message could not be cloned. Read more on MDN
let postMessage: ( t, ~message: JSON.t, ~targetOrigin: string, ~transfer: array<Dict.t<string>>=?,) => unitpostMessageWithOptions
Posts a message to the given window. Messages can be structured objects, e.g. nested objects and arrays, can contain JavaScript values (strings, numbers, Date objects, etc), and can contain certain data objects such as WebApiFile Blob, FileList, and ArrayBuffer objects.
Objects listed in the transfer member of options are transferred, not just cloned, meaning that they are no longer usable on the sending side.
A target origin can be specified using the targetOrigin member of options. If not provided, it defaults to "/". This default restricts the message to same-origin targets only.
If the origin of the target window doesn't match the given target origin, the message is discarded, to avoid information leakage. To send the message to the target regardless of origin, set the target origin to "*".
Throws a "DataCloneError" DOMException if transfer array contains duplicate objects or if message could not be cloned. Read more on MDN
let postMessageWithOptions: ( t, ~message: JSON.t, ~options: windowPostMessageOptions=?,) => unitprompt
let prompt: (t, ~message: string=?, ~default: string=?) => stringqueueMicrotask
let queueMicrotask: (t, unit => unit) => unitremoveEventListener
Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN
let removeEventListener: ( t, EventTypes.eventType, EventTypes.eventListener<'event>, ~options: EventTypes.eventListenerOptions=?,) => unitParameters
t EventTypes.eventType EventTypes.eventListener option< EventTypes.eventListenerOptions >Return type
unitremoveEventListenerUseCapture
Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN
let removeEventListenerUseCapture: ( t, EventTypes.eventType, EventTypes.eventListener<'event>,) => unitreportError
let reportError: (t, JSON.t) => unitrequestAnimationFrame
let requestAnimationFrame: (t, float => unit) => intrequestIdleCallback
let requestIdleCallback: ( t, ~callback: DomTypes.idleDeadline => unit, ~options: DomTypes.idleRequestOptions=?,) => intresizeBy
let resizeBy: (t, ~x: int, ~y: int) => unitresizeTo
let resizeTo: (t, ~width: int, ~height: int) => unitscroll
let scroll: (t, ~options: DomTypes.scrollToOptions=?) => unitscrollbars
Returns true if the scrollbars are visible; otherwise, returns false. Read more on MDN
let scrollbars: t => DomTypes.barPropscrollBy
let scrollBy: (t, ~options: DomTypes.scrollToOptions=?) => unitscrollByXY
let scrollByXY: (t, ~x: float, ~y: float) => unitscrollTo
let scrollTo: (t, ~options: DomTypes.scrollToOptions=?) => unitscrollToXY
let scrollToXY: (t, ~x: float, ~y: float) => unitscrollXY
let scrollXY: (t, ~x: float, ~y: float) => unitsessionStorage
let sessionStorage: t => WebStorageTypes.storagesetInterval
let setInterval: (t, ~handler: string, ~timeout: int=?) => intsetInterval2
let setInterval2: (t, ~handler: unit => unit, ~timeout: int=?) => intsetIntervalWithCallback
let setIntervalWithCallback: (t, ~handler: unit => unit, ~timeout: int=?) => intsetTimeout
Executes a function after a delay given in milliseconds expires.
let setTimeout: ( t, ~handler: unit => unit, ~timeout: int=?,) => DomTypes.timeoutIdspeechSynthesis
let speechSynthesis: t => WebSpeechTypes.speechSynthesisstatusbar
Returns true if the status bar is visible; otherwise, returns false. Read more on MDN
let statusbar: t => DomTypes.barPropstructuredClone
let structuredClone: ( t, 't, ~options: ChannelMessagingTypes.structuredSerializeOptions=?,) => 'ttoolbar
Returns true if the toolbar is visible; otherwise, returns false. Read more on MDN
let toolbar: t => DomTypes.barPropvisualViewport
let visualViewport: t => Null.t<VisualViewport.t>