Window
Module: JavaScript DOM API
The window of the view and the global object in the scripting environment.
#include <Window.idl>
Inherits from EventTarget
Public Functions
| Name | |
|---|---|
| void | scrollBy(optional long x, optional long y) Scrolls the document in the window by the given amount. | 
| void | scrollTo(optional long x, optional long y) Scrolls to a particular set of coordinates in the document. | 
| unsigned long | setTimeout(AnyCallbackTraced handler, optional long timeout) schedule a callback to be executed after timeout milliseconds | 
| void | clearTimeout(unsigned long handle) clear a previous scheduled timer | 
| unsigned long | setInterval(AnyCallbackTraced handler, optional long interval) schedule a callback to be executed at timeout milliseconds intervals | 
| void | clearInterval(unsigned long handle) clear a previous scheduled repeating timer | 
| CSSStyleDeclaration | getComputedStyle(Element element) the last computed style of the element | 
| long | requestAnimationFrame(AnyCallbackTraced callback) | 
| void | cancelAnimationFrame(long id) Cancels an animation frame request previously scheduled through a call to requestAnimationFrame() | 
| void | addEventListener(DOMInternedString type, EventListener listener, optional AddEventListenerOptions options) | 
| void | removeEventListener(DOMInternedString type, EventListener listener, optional RemoveEventListenerOptions useCapture) | 
| void | queueMicrotask(AnyCallbackTraced callback) Schedules a call to the specified callback after the function that enqueues the microtask has finished. | 
| boolean | dispatchEvent(Event event) | 
| Selection | getSelection() Returns a Selection object representing the range of text selected by the user, or the current position of the caret. | 
Public Attributes
| Name | |
|---|---|
| readonly attribute Document | document The document in the current window. | 
| readonly attribute Console | console The console API that can be used for logging. | 
| readonly attribute CoherentDebug | cohDebug The Coherent Debug object used to control various CoHTML options. | 
| readonly attribute Performance | performance | 
| readonly attribute Location | location | 
| readonly attribute Navigator | navigator | 
| readonly attribute Window | self | 
| readonly attribute Storage | localStorage | 
| readonly attribute History | history | 
| readonly attribute Window | parent A reference to the parent of the current window or subframe. | 
| readonly attribute Screen | screen | 
| readonly attribute CustomElementRegistry | customElements Gets the CustomElementRegistrythat can be used to register new custom or get information about registered custom elements. | 
| readonly attribute long | outerHeight Gets the height in pixels of the whole browser window. It represents the height of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles. | 
| readonly attribute long | outerWidth Gets the width of the outside of the browser window. It represents the width of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles. | 
| readonly attribute long | innerHeight Height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar. | 
| readonly attribute long | innerWidth Width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar. | 
| readonly attribute long | screenX Returns the horizontal distance, in CSS pixels, of the left border of the user’s browser from the left side of the screen. | 
| readonly attribute long | screenY Returns the vertical distance, in CSS pixels of the top border of the user’s browser from the top edge of the screen. | 
| readonly attribute long | screenLeft This is an alias for screenX. | 
| readonly attribute long | screenTop This is an alias for screenY. | 
| readonly attribute long | scrollX Returns the number of pixels that the document has already been scrolled horizontally. | 
| readonly attribute long | scrollY Returns the number of pixels that the document has already been scrolled vertically. | 
| readonly attribute long | pageXOffset This is an alias for scrollX. | 
| readonly attribute long | pageYOffset This is an alias for scrollY. | 
| readonly attribute double | devicePixelRatio Returns the ratio of the CSS pixel size to device pixel size. | 
| readonly attribute Chrome | chrome | 
| attribute EventSetter | gamepadconnected | 
| attribute EventSetter | gamepaddisconnected | 
| attribute EventSetter | popstate | 
| attribute EventSetter | resize | 
| attribute EventSetter | unhandledrejection | 
| attribute EventSetter | abort | 
| attribute EventSetter | blur | 
| attribute EventSetter | click | 
| attribute EventSetter | auxclick | 
| attribute EventSetter | dblclick | 
| attribute EventSetter | error | 
| attribute EventSetter | focus | 
| attribute EventSetter | keydown | 
| attribute EventSetter | keypress | 
| attribute EventSetter | keyup | 
| attribute EventSetter | load | 
| attribute EventSetter | mousedown | 
| attribute EventSetter | mouseover | 
| attribute EventSetter | mouseout | 
| attribute EventSetter | mouseenter | 
| attribute EventSetter | mouseleave | 
| attribute EventSetter | mousemove | 
| attribute EventSetter | mouseup | 
| attribute EventSetter | input | 
| attribute EventSetter | scroll | 
| attribute EventSetter | wheel | 
| attribute EventSetter | touchstart | 
| attribute EventSetter | touchend | 
| attribute EventSetter | touchmove | 
Public Functions Documentation
function scrollBy
void scrollBy(
    optional long x,
    optional long y
)
Scrolls the document in the window by the given amount.
Parameters:
- x offset in pixels to scroll horizontally.
- y offset in pixels to scroll vertically.
function scrollTo
void scrollTo(
    optional long x,
    optional long y
)
Scrolls to a particular set of coordinates in the document.
Parameters:
- x is the pixel along the horizontal axis of the document that you want displayed in the upper left.
- y is the pixel along the vertical axis of the document that you want displayed in the upper left.
function setTimeout
unsigned long setTimeout(
    AnyCallbackTraced handler,
    optional long timeout
)
schedule a callback to be executed after timeout milliseconds
Parameters:
- handler a callback without arguments
- timeout the delay in milliseconds.
Return: a handle to the scheduled timer
Note: A 0 delay makes the callback to be executed on the next frame
function clearTimeout
void clearTimeout(
    unsigned long handle
)
clear a previous scheduled timer
Parameters:
- handle a handle returned from setTimeout
function setInterval
unsigned long setInterval(
    AnyCallbackTraced handler,
    optional long interval
)
schedule a callback to be executed at timeout milliseconds intervals
Parameters:
- handler a callback without arguments
- interval the delay in milliseconds.
Return: a handle to the scheduled timer
Note: A 0 delay makes the callback to be executed on the next frame
The first call to the callback will be after timeout milliseconds
function clearInterval
void clearInterval(
    unsigned long handle
)
clear a previous scheduled repeating timer
Parameters:
- handle a handle returned from setInterval
function getComputedStyle
CSSStyleDeclaration getComputedStyle(
    Element element
)
the last computed style of the element
Parameters:
- element the element whose style to get
function requestAnimationFrame
long requestAnimationFrame(
    AnyCallbackTraced callback
)
function cancelAnimationFrame
void cancelAnimationFrame(
    long id
)
Cancels an animation frame request previously scheduled through a call to requestAnimationFrame()
Parameters:
- id The ID of the request to cancel.
function addEventListener
void addEventListener(
    DOMInternedString type,
    EventListener listener,
    optional AddEventListenerOptions options
)
Reimplements: EventTarget::addEventListener
function removeEventListener
void removeEventListener(
    DOMInternedString type,
    EventListener listener,
    optional RemoveEventListenerOptions useCapture
)
Reimplements: EventTarget::removeEventListener
function queueMicrotask
void queueMicrotask(
    AnyCallbackTraced callback
)
Schedules a call to the specified callback after the function that enqueues the microtask has finished.
Parameters:
- callback The callback to be invoked.
function dispatchEvent
boolean dispatchEvent(
    Event event
)
Reimplements: EventTarget::dispatchEvent
function getSelection
Selection getSelection()
Returns a Selection object representing the range of text selected by the user, or the current position of the caret.
Public Attributes Documentation
variable document
readonly attribute Document document;
The document in the current window.
variable console
readonly attribute Console console;
The console API that can be used for logging.
variable cohDebug
readonly attribute CoherentDebug cohDebug;
The Coherent Debug object used to control various CoHTML options.
variable performance
readonly attribute Performance performance;
variable location
readonly attribute Location location;
variable navigator
readonly attribute Navigator navigator;
variable self
readonly attribute Window self;
variable localStorage
readonly attribute Storage localStorage;
variable history
readonly attribute History history;
variable parent
readonly attribute Window parent;
A reference to the parent of the current window or subframe.
Note: If a window does not have a parent, its parent property is a reference to itself.
variable screen
readonly attribute Screen screen;
variable customElements
readonly attribute CustomElementRegistry customElements;
Gets the CustomElementRegistry that can be used to register new custom or get information about registered custom elements.
variable outerHeight
readonly attribute long outerHeight;
Gets the height in pixels of the whole browser window. It represents the height of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles.
variable outerWidth
readonly attribute long outerWidth;
Gets the width of the outside of the browser window. It represents the width of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles.
variable innerHeight
readonly attribute long innerHeight;
Height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar.
variable innerWidth
readonly attribute long innerWidth;
Width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar.
variable screenX
readonly attribute long screenX;
Returns the horizontal distance, in CSS pixels, of the left border of the user’s browser from the left side of the screen.
variable screenY
readonly attribute long screenY;
Returns the vertical distance, in CSS pixels of the top border of the user’s browser from the top edge of the screen.
variable screenLeft
readonly attribute long screenLeft;
This is an alias for screenX.
variable screenTop
readonly attribute long screenTop;
This is an alias for screenY.
variable scrollX
readonly attribute long scrollX;
Returns the number of pixels that the document has already been scrolled horizontally.
variable scrollY
readonly attribute long scrollY;
Returns the number of pixels that the document has already been scrolled vertically.
variable pageXOffset
readonly attribute long pageXOffset;
This is an alias for scrollX.
variable pageYOffset
readonly attribute long pageYOffset;
This is an alias for scrollY.
variable devicePixelRatio
readonly attribute double devicePixelRatio;
Returns the ratio of the CSS pixel size to device pixel size.
variable chrome
readonly attribute Chrome chrome;
variable gamepadconnected
attribute EventSetter gamepadconnected;
variable gamepaddisconnected
attribute EventSetter gamepaddisconnected;
variable popstate
attribute EventSetter popstate;
variable resize
attribute EventSetter resize;
variable unhandledrejection
attribute EventSetter unhandledrejection;
variable abort
attribute EventSetter abort;
variable blur
attribute EventSetter blur;
variable click
attribute EventSetter click;
variable auxclick
attribute EventSetter auxclick;
variable dblclick
attribute EventSetter dblclick;
variable error
attribute EventSetter error;
variable focus
attribute EventSetter focus;
variable keydown
attribute EventSetter keydown;
variable keypress
attribute EventSetter keypress;
variable keyup
attribute EventSetter keyup;
variable load
attribute EventSetter load;
variable mousedown
attribute EventSetter mousedown;
variable mouseover
attribute EventSetter mouseover;
variable mouseout
attribute EventSetter mouseout;
variable mouseenter
attribute EventSetter mouseenter;
variable mouseleave
attribute EventSetter mouseleave;
variable mousemove
attribute EventSetter mousemove;
variable mouseup
attribute EventSetter mouseup;
variable input
attribute EventSetter input;
variable scroll
attribute EventSetter scroll;
variable wheel
attribute EventSetter wheel;
variable touchstart
attribute EventSetter touchstart;
variable touchend
attribute EventSetter touchend;
variable touchmove
attribute EventSetter touchmove;