Try Install Learn Blog API Packages GitHub
Pages
Standard Library

Search
Entities

Window

Functions

addEventListener
(
type
:
String
capture
:
Bool
listener
:
Function(Html.Event, a)
)
:
Function(Void)

Adds a listener to the window and returns the function which removes this listener.

addMediaQueryListener
(
query
:
String
listener
:
Function(Bool, a)
)
:
Function(Void)

Adds a media query listener to the window and returns the function which removes this listener.

alert
(
message
:
String
)
:
Promise(Never, Void)

Shows the default alert popup of the browser with the given message.

This function returns a promise but blocks execution until the popup is closed.

confirm
(
message
:
String
)
:
Promise(String, Void)

Shows the default confirm popup of the browser with the given message.

This function returns a promise but blocks execution until the popup is closed.

Gets the width of the scrollbar.

Window.getScrollbarWidth() == 10
height
:
Number

Returns the height of the window in pixels.

href
:
String

Returns the windows URL as a string.

isActiveURL
(
url
:
String
)
:
Bool

Returns true if the given url is the same as the current url of the page.

matchesMediaQuery
(
query
:
String
)
:
Bool

Returns true if the given media query matches.

navigate
(
url
:
String
)
:
Promise(Never, Void)

Navigates to the given URL.

open
(
url
:
String
)
:
Promise(Never, Void)

Opens the given url in a new window.

Window.open("https://www.google.com")
prompt
(
label
:
String
current
:
String
)
:
Promise(String, String)

Shows the default prompt popup of the browser with the given message and value.

This function returns a promise but blocks execution until the popup is closed.

Returns the scrollable height of the window in pixels.

scrollLeft
:
Number

Returns the horizontal scroll position of the window in pixels.

scrollTop
:
Number

Returns the vertical scroll position of the window in pixels.

Returns the scrollable width of the window in pixels.

setScrollLeft
(
position
:
Number
)
:
Promise(Never, Void)

Sets the vertical scroll position of the window in pixels.

setScrollTop
(
position
:
Number
)
:
Promise(Never, Void)

Sets the horizontal scroll position of the window in pixels.

setTitle
(
title
:
String
)
:
Promise(Never, Void)

Sets the windows title.

setUrl
(
url
:
String
)
:
Promise(Never, Void)

Sets the URL of the window without navigating to it.

title
:
String

Returns the windows title.

triggerHashJump
:
Promise(Never, Void)

Triggers the hash location jump on the page.

When a page loads and the current url has a hash #achor-name the browser automatically jumps to the matching anchor tag <a name="achor-name">, but this behavior does not happen when the history is manipulated.

This function triggers that behavior.

url
:
Url

Returns the current Url of the window.

width
:
Number

Returns the width of the window in pixels.