Window 

Kind: global interface


window.isClient() ⇒ boolean 

Returns true if invoked at the client side.

Kind: instance method of Window
Returns: boolean - true if invoked at the client side.


window.isCookieEnabled() ⇒ boolean 

Returns true if the cookies are set and processed with every HTTP request and response automatically by the environment.

Kind: instance method of Window
Returns: boolean - true if cookies are handled automatically by the environment.


window.hasSessionStorage() ⇒ boolean 

Returns true if the session storage is supported.

Kind: instance method of Window
Returns: boolean - true if the session storage is supported.


window.setTitle(title) 

Sets the new page title of the document.

Kind: instance method of Window

Param Type Description
title string The new page title.

window.getWebSocket() ⇒ function 

Deprecated

Returns the current WebSocket implementation to use.

Kind: instance method of Window
Returns: function - The current WebSocket implementation.


window.getWindow() ⇒ undefined | Window 

Returns the native window object representing the global context at the client-side. The method returns undefined if used at the server-side.

Kind: instance method of Window
Returns: undefined | Window - The window object at the client-side, or undefined at the server-side.


window.getDocument() ⇒ undefined | Document 

Returns the native document object representing any web page loaded in the browser and serves as an entry point into the web page’s content which is the DOM tree at the client-side. The method returns undefined if used at the server-side.

Kind: instance method of Window
Returns: undefined | Document - The document object at the client-side, or undefined at the server-side.


window.getScrollX() ⇒ number 

Returns the number of pixels the viewport is scrolled horizontally.

Kind: instance method of Window
Returns: number - The number of pixels the viewport is scrolled horizontally.


window.getScrollY() ⇒ number 

Returns the number of pixels the document is scrolled vertically.

Kind: instance method of Window
Returns: number - The number of pixels the document is scrolled vertically.


window.scrollTo(x, y) 

Scrolls the viewport to the specified location (if possible).

Kind: instance method of Window

Param Type Description
x number Horizontal scroll offset in pixels.
y number Vertical scroll offset in pixels.

window.getDomain() ⇒ string 

Returns the domain of the current document’s URL as `${protocol://${host}`}.

Kind: instance method of Window
Returns: string - The current domain.


window.getHost() ⇒ string 

Returns the application’s host.

Kind: instance method of Window
Returns: string - The current host.


window.getPath() ⇒ string 

Returns the path part of the current URL, including the query string.

Kind: instance method of Window
Returns: string - The path and query string parts of the current URL.


window.getUrl() ⇒ string 

Returns the current document’s URL.

Kind: instance method of Window
Returns: string - The current document’s URL.


window.getBody() ⇒ undefined | HTMLBodyElement 

Returns the document’s body element. The method returns undefined if invoked at the server-side.

Kind: instance method of Window
Returns: undefined | HTMLBodyElement - The document’s body element, or undefined if invoked at the server side.


window.getElementById(id) ⇒ HTMLElement 

Returns the HTML element with the specified id attribute value.

Kind: instance method of Window
Returns: HTMLElement - The element with the specified id, or null if no such element exists.

Param Type Description
id string The value of the id attribute to look for.

window.getHistoryState() ⇒ Object 

Returns the history state.

Kind: instance method of Window
Returns: Object - The current history state


window.querySelector(selector) ⇒ HTMLElement 

Returns the first element matching the specified CSS 3 selector.

Kind: instance method of Window
Returns: HTMLElement - The first element matching the CSS selector or null if no such element exists.

Param Type Description
selector string The CSS selector.

window.querySelectorAll(selector) ⇒ NodeList 

Returns a node list of all elements matching the specified CSS 3 selector.

Kind: instance method of Window
Returns: NodeList - A node list containing all elements matching the specified CSS selector.

Param Type Description
selector string The CSS selector.

window.redirect(url) 

Performs a hard redirect (discarding the current JavaScript state) to the specified URL.

Kind: instance method of Window

Param Type Description
url string The URL to which the browser will be redirected.

window.pushState(state, title, url) 

Pushes a new state to the browser history. The method has no effect if the current browser does not support the history API (IE9).

Kind: instance method of Window

Param Type Description
state Object.<string, \*> A state object associated with the history item, preferably representing the page state.
title string The page title related to the state. Note that this parameter is ignored by some browsers.
url string The new URL at which the state is available.

window.replaceState(state, title, [url]) 

Replaces the current history entry. The method has no effect if the current browser does not support the history API (IE9).

Kind: instance method of Window

Param Type Default Description
state Object.<string, \*>   A state object associated with the history item, preferably representing the page state.
title string   The page title related to the state. Note that this parameter is ignored by some browsers.
[url] string null The new URL at which the state is available.

window.createCustomEvent(name, options) ⇒ CustomEvent 

Create new instance of CustomEvent of the specified name and using the provided options.

Kind: instance method of Window
Returns: CustomEvent - The created custom event.
See: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent

Param Type Description
name string Custom event’s name (sometimes referred to as the event’s type).
options Object.<string, \*> The custom event’s options.

window.bindEventListener(eventTarget, event, listener, [useCapture]) 

Registers the provided event listener to be executed when the specified event occurs on the specified event target.

Registering the same event listener for the same event on the same event target with the same useCapture flag value repeatedly has no effect.

Kind: instance method of Window

Param Type Default Description
eventTarget EventTarget   The event target.
event string   The name of the event.
listener function   The event listener.
[useCapture] boolean false If true, the method initiates event capture. After initiating capture, all events of the specified type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree. Events which are bubbling upward through the tree will not trigger a listener designated to use capture.

window.unbindEventListener(eventTarget, event, listener, [useCapture]) 

Deregisters the provided event listener, so it will no longer we executed when the specified event occurs on the specified event target.

The method has no effect if the provided event listener is not registered to be executed at the specified event.

Kind: instance method of Window

Param Type Default Description
eventTarget EventTarget   The event target.
event string   The name of the event.
listener function   The event listener.
[useCapture] boolean false The useCapture flag value that was used when the listener was registered.