W3cubDocs

/Haxe JavaScript

Window

package js.html

extends EventTarget

Available on js

The Window interface represents a window containing a DOM document; the document property points to the DOM document loaded in that window.

Documentation Window by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Variables

read onlycaches:CacheStorage

read onlyclosed:Bool

This property indicates whether the current window is closed or not.

read onlyconsole:ConsoleInstance

Returns a reference to the console object which provides access to the browser's debugging console.

read onlycontent:Dynamic

Returns a reference to the content element in the current window. Since Firefox 57 (initially Nightly-only), both versions are only available from chrome (privileged) code, and not available to the web anymore.

read onlycrypto:Crypto

Returns the browser crypto object.

read onlydevicePixelRatio:Float

Returns the ratio between physical pixels and device independent pixels in the current display.

read onlydocument:HTMLDocument

Returns a reference to the document that the window contains.

read onlyevent:Dynamic

Returns the current event, which is the event currently being handled by the JavaScript code's context, or undefined if no event is currently being handled. The Event object passed directly to event handlers should be used instead whenever possible.

read onlyframeElement:Element

Returns the element in which the window is embedded, or null if the window is not embedded.

read onlyframes:Window

Returns an array of the subframes in the current window.

fullScreen:Bool

This property indicates whether the window is displayed in full screen or not.

read onlyhistory:History

Returns a reference to the history object.

read onlyindexedDB:Factory

innerHeight:Dynamic

Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.

innerWidth:Dynamic

Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.

read onlyisSecureContext:Bool

Indicates whether a context is capable of using features that require secure contexts.

read onlylength:Int

Returns the number of frames in the window. See also window.frames.

read onlylocalStorage:Storage

Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.

read onlylocation:Location

Gets/sets the location, or current URL, of the window object.

read onlylocationbar:BarProp

Returns the locationbar object, whose visibility can be toggled in the window.

Returns the menubar object, whose visibility can be toggled in the window.

name:String

Gets/sets the name of the window.

Returns a reference to the navigator object.

onabort:Function

onabsolutedeviceorientation:Function

onafterprint:Function

onanimationcancel:Function

onanimationend:Function

onanimationiteration:Function

onanimationstart:Function

onauxclick:Function

onbeforeprint:Function

onblur:Function

oncanplay:Function

oncanplaythrough:Function

onchange:Function

onclick:Function

onclose:Function

oncontextmenu:Function

ondblclick:Function

ondevicelight:Function

ondevicemotion:Function

ondeviceorientation:Function

ondeviceproximity:Function

ondrag:Function

ondragend:Function

ondragenter:Function

ondragexit:Function

ondragleave:Function

ondragover:Function

ondragstart:Function

ondrop:Function

ondurationchange:Function

onemptied:Function

onended:Function

onfocus:Function

ongotpointercapture:Function

onhashchange:Function

oninput:Function

oninvalid:Function

onkeydown:Function

onkeypress:Function

onkeyup:Function

onlanguagechange:Function

onload:Function

onloadeddata:Function

onloadedmetadata:Function

onloadend:Function

onloadstart:Function

onlostpointercapture:Function

onmessage:Function

onmessageerror:Function

onmousedown:Function

onmouseenter:Function

onmouseleave:Function

onmousemove:Function

onmouseout:Function

onmouseover:Function

onmouseup:Function

onoffline:Function

ononline:Function

onorientationchange:Function

onpagehide:Function

onpageshow:Function

onpause:Function

onplay:Function

onplaying:Function

onpointercancel:Function

onpointerdown:Function

onpointerenter:Function

onpointerleave:Function

onpointermove:Function

onpointerout:Function

onpointerover:Function

onpointerup:Function

onpopstate:Function

onprogress:Function

onratechange:Function

onreset:Function

onresize:Function

onscroll:Function

onseeked:Function

onseeking:Function

onselect:Function

onselectstart:Function

onshow:Function

onstalled:Function

onstorage:Function

onsubmit:Function

onsuspend:Function

ontimeupdate:Function

ontoggle:Function

ontouchcancel:Function

ontouchend:Function

ontouchmove:Function

ontouchstart:Function

ontransitioncancel:Function

ontransitionend:Function

ontransitionrun:Function

ontransitionstart:Function

onunload:Function

onuserproximity:Function

onvolumechange:Function

onwaiting:Function

onwebkitanimationend:Function

onwebkitanimationiteration:Function

onwebkitanimationstart:Function

onwebkittransitionend:Function

onwheel:Function

opener:Dynamic

Returns a reference to the window that opened this current window.

read onlyorientation:Int

Returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation.

read onlyorigin:String

outerHeight:Dynamic

Gets the height of the outside of the browser window.

outerWidth:Dynamic

Gets the width of the outside of the browser window.

read onlypageXOffset:Float

An alias for window.scrollX.

read onlypageYOffset:Float

An alias for window.scrollY

read onlyparent:Window

Returns a reference to the parent of the current window or subframe.

read onlyperformance:Performance

Returns a Performance object, which includes the Performance.timing and Performance.navigation attributes, each of which is an object providing performance-related data. See also Using Navigation Timing for additional information and examples.

read onlypersonalbar:BarProp

Returns the personalbar object, whose visibility can be toggled in the window.

read onlyscreen:Screen

Returns a reference to the screen object associated with the window.

screenX:Dynamic

Returns the horizontal distance of the left border of the user's browser from the left side of the screen.

screenY:Dynamic

Returns the vertical distance of the top border of the user's browser from the top side of the screen.

read onlyscrollMaxX:Int

The maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width.

read onlyscrollMaxY:Int

The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).

read onlyscrollX:Float

Returns the number of pixels that the document has already been scrolled horizontally.

read onlyscrollY:Float

Returns the number of pixels that the document has already been scrolled vertically.

read onlyscrollbars:BarProp

Returns the scrollbars object, whose visibility can be toggled in the window.

read onlyself:Window

Returns an object reference to the window object itself.

read onlysessionStorage:Storage

Returns a reference to the session storage object used to store data that may only be accessed by the origin that created it.

read onlyspeechSynthesis:SpeechSynthesis

Returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality.

status:String

Gets/sets the text in the statusbar at the bottom of the browser.

read onlystatusbar:BarProp

Returns the statusbar object, whose visibility can be toggled in the window.

read onlytoolbar:BarProp

Returns the toolbar object, whose visibility can be toggled in the window.

read onlytop:Window

Returns a reference to the topmost window in the window hierarchy. This property is read only.

read onlywindow:Window

Returns a reference to the current window.

onbeforeunload:Event ‑> Null<String>

onerror:(EitherType<Event, String>, String, Int, Int, Dynamic) ‑> Dynamic

Methods

alert(message:String):Void

alert():Void

Displays an alert dialog.

Throws:

null

DOMError

atob(atob:String):String

Throws:

null

DOMError

blur():Void

Sets focus away from the window.

Throws:

null

DOMError

btoa(btoa:String):String

Throws:

null

DOMError

cancelAnimationFrame(handle:Int):Void

Enables you to cancel a callback previously scheduled with Window.requestAnimationFrame.

Throws:

null

DOMError

captureEvents():Void

Registers the window to capture all events of the specified type.

clearInterval(handle:Int = 0):Void

clearTimeout(handle:Int = 0):Void

close():Void

Closes the current window.

Throws:

null

DOMError

confirm(message:String = ""):Bool

Displays a dialog with a message that the user needs to respond to.

Throws:

null

DOMError

createImageBitmap(aImage:ImageElement, aOffset:Int, aLength:Int, aFormat:ImageBitmapFormat, aLayout:Array<ChannelPixelLayout>):Promise<ImageBitmap>

createImageBitmap(aImage:VideoElement):Promise<ImageBitmap>

createImageBitmap(aImage:CanvasElement):Promise<ImageBitmap>

createImageBitmap(aImage:Blob):Promise<ImageBitmap>

createImageBitmap(aImage:ImageData):Promise<ImageBitmap>

createImageBitmap(aImage:CanvasRenderingContext2D):Promise<ImageBitmap>

createImageBitmap(aImage:ImageBitmap):Promise<ImageBitmap>

createImageBitmap(aImage:ArrayBufferView):Promise<ImageBitmap>

createImageBitmap(aImage:ArrayBuffer):Promise<ImageBitmap>

createImageBitmap(aImage:VideoElement, aSx:Int, aSy:Int, aSw:Int, aSh:Int):Promise<ImageBitmap>

createImageBitmap(aImage:CanvasElement, aSx:Int, aSy:Int, aSw:Int, aSh:Int):Promise<ImageBitmap>

createImageBitmap(aImage:Blob, aSx:Int, aSy:Int, aSw:Int, aSh:Int):Promise<ImageBitmap>

createImageBitmap(aImage:ImageData, aSx:Int, aSy:Int, aSw:Int, aSh:Int):Promise<ImageBitmap>

createImageBitmap(aImage:CanvasRenderingContext2D, aSx:Int, aSy:Int, aSw:Int, aSh:Int):Promise<ImageBitmap>

createImageBitmap(aImage:ImageBitmap, aSx:Int, aSy:Int, aSw:Int, aSh:Int):Promise<ImageBitmap>

createImageBitmap(aImage:ArrayBufferView, aSx:Int, aSy:Int, aSw:Int, aSh:Int):Promise<ImageBitmap>

createImageBitmap(aImage:ArrayBuffer, aSx:Int, aSy:Int, aSw:Int, aSh:Int):Promise<ImageBitmap>

createImageBitmap(aImage:VideoElement, aOffset:Int, aLength:Int, aFormat:ImageBitmapFormat, aLayout:Array<ChannelPixelLayout>):Promise<ImageBitmap>

createImageBitmap(aImage:CanvasElement, aOffset:Int, aLength:Int, aFormat:ImageBitmapFormat, aLayout:Array<ChannelPixelLayout>):Promise<ImageBitmap>

createImageBitmap(aImage:Blob, aOffset:Int, aLength:Int, aFormat:ImageBitmapFormat, aLayout:Array<ChannelPixelLayout>):Promise<ImageBitmap>

createImageBitmap(aImage:ImageData, aOffset:Int, aLength:Int, aFormat:ImageBitmapFormat, aLayout:Array<ChannelPixelLayout>):Promise<ImageBitmap>

createImageBitmap(aImage:CanvasRenderingContext2D, aOffset:Int, aLength:Int, aFormat:ImageBitmapFormat, aLayout:Array<ChannelPixelLayout>):Promise<ImageBitmap>

createImageBitmap(aImage:ImageBitmap, aOffset:Int, aLength:Int, aFormat:ImageBitmapFormat, aLayout:Array<ChannelPixelLayout>):Promise<ImageBitmap>

createImageBitmap(aImage:ArrayBufferView, aOffset:Int, aLength:Int, aFormat:ImageBitmapFormat, aLayout:Array<ChannelPixelLayout>):Promise<ImageBitmap>

createImageBitmap(aImage:ArrayBuffer, aOffset:Int, aLength:Int, aFormat:ImageBitmapFormat, aLayout:Array<ChannelPixelLayout>):Promise<ImageBitmap>

createImageBitmap(aImage:ImageElement):Promise<ImageBitmap>

createImageBitmap(aImage:ImageElement, aSx:Int, aSy:Int, aSw:Int, aSh:Int):Promise<ImageBitmap>

Throws:

null

DOMError

dump(str:String):Void

Writes a message to the console.

fetch(input:Request, ?init:Null<RequestInit>):Promise<Response>

fetch(input:String, ?init:Null<RequestInit>):Promise<Response>

find(str:String = "", caseSensitive:Bool = false, backwards:Bool = false, wrapAround:Bool = false, wholeWord:Bool = false, searchInFrames:Bool = false, showDialog:Bool = false):Bool

Searches for a given string in a window.

Throws:

null

DOMError

focus():Void

Sets focus on the current window.

Throws:

null

DOMError

getComputedStyle(elt:Element, pseudoElt:String = ""):CSSStyleDeclaration

Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.

Throws:

null

DOMError

getDefaultComputedStyle(elt:Element, pseudoElt:String = ""):CSSStyleDeclaration

Gets default computed style for the specified element, ignoring author stylesheets.

Throws:

null

DOMError

getSelection():Selection

Returns the selection object representing the selected item(s).

Throws:

null

DOMError

matchMedia(query:String):MediaQueryList

Returns a MediaQueryList object representing the specified media query string.

Throws:

null

DOMError

moveBy(x:Int, y:Int):Void

Moves the current window by a specified amount.

Throws:

null

DOMError

moveTo(x:Int, y:Int):Void

Moves the window to the specified coordinates.

Throws:

null

DOMError

open(url:String = "", target:String = "", features:String = ""):Window

Opens a new window.

Throws:

null

DOMError

postMessage(message:Dynamic, targetOrigin:String, ?transfer:Array<Dynamic>):Void

Provides a secure means for one window to send a string of data to another window, which need not be within the same domain as the first.

Throws:

null

DOMError

print():Void

Opens the Print Dialog to print the current document.

Throws:

null

DOMError

prompt(message:String = "", default_:String = ""):String

Returns the text entered by the user in a prompt dialog.

Throws:

null

DOMError

releaseEvents():Void

Releases the window from trapping events of a specific type.

requestAnimationFrame(callback:Float ‑> Void):Int

Tells the browser that an animation is in progress, requesting that the browser schedule a repaint of the window for the next animation frame.

Throws:

null

DOMError

resizeBy(x:Int, y:Int):Void

Resizes the current window by a certain amount.

Throws:

null

DOMError

resizeTo(x:Int, y:Int):Void

Dynamically resizes window.

Throws:

null

DOMError

scroll(?options:Null<ScrollToOptions>):Void

scroll(x:Float, y:Float):Void

Scrolls the window to a particular place in the document.

scrollBy(?options:Null<ScrollToOptions>):Void

scrollBy(x:Float, y:Float):Void

Scrolls the document in the window by the given amount.

scrollByLines(numLines:Int, ?options:Null<ScrollOptions>):Void

Scrolls the document by the given number of lines.

scrollByPages(numPages:Int, ?options:Null<ScrollOptions>):Void

Scrolls the current document by the specified number of pages.

scrollTo(?options:Null<ScrollToOptions>):Void

scrollTo(x:Float, y:Float):Void

Scrolls to a particular set of coordinates in the document.

setInterval(handler:String, timeout:Float = 0, unused:Rest<Dynamic>):Int

setInterval(handler:Function, timeout:Float = 0, arguments:Rest<Dynamic>):Int

Throws:

null

DOMError

setResizable(resizable:Bool):Void

Toggles a user's ability to resize a window.

setTimeout(handler:String, timeout:Float = 0, unused:Rest<Dynamic>):Int

setTimeout(handler:Function, timeout:Float = 0, arguments:Rest<Dynamic>):Int

Throws:

null

DOMError

sizeToContent():Void

Sizes the window according to its content.

Throws:

null

DOMError

stop():Void

This method stops window loading.

Throws:

null

DOMError

updateCommands(action:String, ?sel:Selection, reason:Int = 0):Void

Updates the state of commands of the current chrome window (UI).

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/Window.html