Top-level container for the current browser tab or window.

In a web browser, each window has a Window object, but within the context of a script, this object represents only the current window. Each other window, tab, and iframe has its own Window object.

Each window contains a Document object, which contains all of the window's content.

Use the top-level window object to access the current window. For example:

// Draw a scene when the window repaints.
drawScene(num delta) {...}
window.animationFrame.then(drawScene);.

// Write to the console.
window.console.log('Jinkies!');
window.console.error('Jeepers!');

Note: This class represents only the current window, while WindowBase is a representation of any window, including other tabs, windows, and frames.

See also

Other resources

Inheritance
Implements
Annotations
  • DocsEditable()
  • DomName('Window')

Constants

EventStreamProvider<AnimationEvent> animationEndEvent = const EventStreamProvider<AnimationEvent>('webkitAnimationEnd')
const

Static factory designed to expose animationend events to event handlers that are not necessarily instances of Window.

EventStreamProvider<AnimationEvent> animationIterationEvent = const EventStreamProvider<AnimationEvent>('webkitAnimationIteration')
const

Static factory designed to expose animationiteration events to event handlers that are not necessarily instances of Window.

EventStreamProvider<AnimationEvent> animationStartEvent = const EventStreamProvider<AnimationEvent>('webkitAnimationStart')
const

Static factory designed to expose animationstart events to event handlers that are not necessarily instances of Window.

EventStreamProvider<BeforeUnloadEvent> beforeUnloadEvent = const _BeforeUnloadEventStreamProvider<BeforeUnloadEvent>('beforeunload')
const

Static factory designed to expose beforeunload events to event handlers that are not necessarily instances of Window.

EventStreamProvider<Event> contentLoadedEvent = const EventStreamProvider<Event>('DOMContentLoaded')
const

Static factory designed to expose contentloaded events to event handlers that are not necessarily instances of Window.

EventStreamProvider<DeviceMotionEvent> deviceMotionEvent = const EventStreamProvider<DeviceMotionEvent>('devicemotion')
const

Static factory designed to expose devicemotion events to event handlers that are not necessarily instances of Window.

EventStreamProvider<DeviceOrientationEvent> deviceOrientationEvent = const EventStreamProvider<DeviceOrientationEvent>('deviceorientation')
const

Static factory designed to expose deviceorientation events to event handlers that are not necessarily instances of Window.

EventStreamProvider<Event> hashChangeEvent = const EventStreamProvider<Event>('hashchange')
const

Static factory designed to expose hashchange events to event handlers that are not necessarily instances of Window.

EventStreamProvider<Event> loadStartEvent = const EventStreamProvider<Event>('loadstart')
const

EventStreamProvider<MessageEvent> messageEvent = const EventStreamProvider<MessageEvent>('message')
const

Static factory designed to expose message events to event handlers that are not necessarily instances of Window.

EventStreamProvider<Event> offlineEvent = const EventStreamProvider<Event>('offline')
const

Static factory designed to expose offline events to event handlers that are not necessarily instances of Window.

EventStreamProvider<Event> onlineEvent = const EventStreamProvider<Event>('online')
const

Static factory designed to expose online events to event handlers that are not necessarily instances of Window.

EventStreamProvider<Event> pageHideEvent = const EventStreamProvider<Event>('pagehide')
const

Static factory designed to expose pagehide events to event handlers that are not necessarily instances of Window.

EventStreamProvider<Event> pageShowEvent = const EventStreamProvider<Event>('pageshow')
const

Static factory designed to expose pageshow events to event handlers that are not necessarily instances of Window.

int PERSISTENT = 1
const

Indicates that file system data cannot be cleared unless given user permission.

EventStreamProvider<PopStateEvent> popStateEvent = const EventStreamProvider<PopStateEvent>('popstate')
const

Static factory designed to expose popstate events to event handlers that are not necessarily instances of Window.

EventStreamProvider<Event> progressEvent = const EventStreamProvider<Event>('progress')
const

EventStreamProvider<StorageEvent> storageEvent = const EventStreamProvider<StorageEvent>('storage')
const

Static factory designed to expose storage events to event handlers that are not necessarily instances of Window.

int TEMPORARY = 0
const

Indicates that file system data can be cleared at any time.

EventStreamProvider<Event> unloadEvent = const EventStreamProvider<Event>('unload')
const

Static factory designed to expose unload events to event handlers that are not necessarily instances of Window.

Static Properties

supportsPointConversions bool
read-only

convertPointFromNodeToPage and convertPointFromPageToNode are removed. see http://dev.w3.org/csswg/cssom-view/#geometry

Properties

animationFrame Future<num>
read-only

Returns a Future that completes just before the window is about to repaint so the user can draw an animation frame.

applicationCache ApplicationCache
read-only

The application cache for this window.

closed bool
read-only

console Console
read-only

crypto Crypto
read-only

Entrypoint for the browser's cryptographic functions.

css Css
read-only

Entrypoint for CSS-related functions.

defaultstatus String
read / write

Deprecated*.

defaultStatus String
read / write

Deprecated*.

devicePixelRatio double
read-only

The ratio between physical pixels and logical CSS pixels.

document Document
read-only

history History
read-only

The current session history for this window's newest document.

indexedDB IdbFactory
read-only

innerHeight int
read-only

The height of the viewport including scrollbars.

innerWidth int
read-only

The width of the viewport including scrollbars.

localStorage Storage
read-only

Storage for this window that persists across sessions.

location Location
read-only

locationbar BarProp
read-only

This window's location bar, which displays the URL.

read-only

This window's menu bar, which displays menu commands.

name String
read / write

The name of this window.

read-only

The user agent accessing this window.

offscreenBuffering bool
read-only

Whether objects are drawn offscreen before being displayed.

on Events
read-only, inherited

This is an ease-of-use accessor for event streams which should only be used when an explicit accessor is not available.

onAbort Stream<Event>
read-only

Stream of abort events handled by this Window.

onAnimationEnd Stream<AnimationEvent>
read-only

Stream of animationend events handled by this Window.

onAnimationIteration Stream<AnimationEvent>
read-only

Stream of animationiteration events handled by this Window.

onAnimationStart Stream<AnimationEvent>
read-only

Stream of animationstart events handled by this Window.

onBeforeUnload Stream<Event>
read-only

Stream of beforeunload events handled by this Window.

onBlur Stream<Event>
read-only

Stream of blur events handled by this Window.

onCanPlay Stream<Event>
read-only

onCanPlayThrough Stream<Event>
read-only

onChange Stream<Event>
read-only

Stream of change events handled by this Window.

onClick Stream<MouseEvent>
read-only

Stream of click events handled by this Window.

onContentLoaded Stream<Event>
read-only

Stream of contentloaded events handled by this Window.

onContextMenu Stream<MouseEvent>
read-only

Stream of contextmenu events handled by this Window.

onDeviceMotion Stream<DeviceMotionEvent>
read-only

Stream of devicemotion events handled by this Window.

onDeviceOrientation Stream<DeviceOrientationEvent>
read-only

Stream of deviceorientation events handled by this Window.

onDoubleClick Stream<Event>
read-only

Stream of doubleclick events handled by this Window.

onDrag Stream<MouseEvent>
read-only

Stream of drag events handled by this Window.

onDragEnd Stream<MouseEvent>
read-only

Stream of dragend events handled by this Window.

onDragEnter Stream<MouseEvent>
read-only

Stream of dragenter events handled by this Window.

onDragLeave Stream<MouseEvent>
read-only

Stream of dragleave events handled by this Window.

onDragOver Stream<MouseEvent>
read-only

Stream of dragover events handled by this Window.

onDragStart Stream<MouseEvent>
read-only

Stream of dragstart events handled by this Window.

onDrop Stream<MouseEvent>
read-only

Stream of drop events handled by this Window.

onDurationChange Stream<Event>
read-only

onEmptied Stream<Event>
read-only

onEnded Stream<Event>
read-only

onError Stream<Event>
read-only

Stream of error events handled by this Window.

onFocus Stream<Event>
read-only

Stream of focus events handled by this Window.

onHashChange Stream<Event>
read-only

Stream of hashchange events handled by this Window.

onInput Stream<Event>
read-only

Stream of input events handled by this Window.

onInvalid Stream<Event>
read-only

Stream of invalid events handled by this Window.

onKeyDown Stream<KeyboardEvent>
read-only

Stream of keydown events handled by this Window.

onKeyPress Stream<KeyboardEvent>
read-only

Stream of keypress events handled by this Window.

onKeyUp Stream<KeyboardEvent>
read-only

Stream of keyup events handled by this Window.

onLoad Stream<Event>
read-only

Stream of load events handled by this Window.

onLoadedData Stream<Event>
read-only

onLoadedMetadata Stream<Event>
read-only

onLoadStart Stream<Event>
read-only

onMessage Stream<MessageEvent>
read-only

Stream of message events handled by this Window.

onMouseDown Stream<MouseEvent>
read-only

Stream of mousedown events handled by this Window.

onMouseEnter Stream<MouseEvent>
read-only

Stream of mouseenter events handled by this Window.

onMouseLeave Stream<MouseEvent>
read-only

Stream of mouseleave events handled by this Window.

onMouseMove Stream<MouseEvent>
read-only

Stream of mousemove events handled by this Window.

onMouseOut Stream<MouseEvent>
read-only

Stream of mouseout events handled by this Window.

onMouseOver Stream<MouseEvent>
read-only

Stream of mouseover events handled by this Window.

onMouseUp Stream<MouseEvent>
read-only

Stream of mouseup events handled by this Window.

onMouseWheel Stream<WheelEvent>
read-only

Stream of mousewheel events handled by this Window.

onOffline Stream<Event>
read-only

Stream of offline events handled by this Window.

onOnline Stream<Event>
read-only

Stream of online events handled by this Window.

onPageHide Stream<Event>
read-only

Stream of pagehide events handled by this Window.

onPageShow Stream<Event>
read-only

Stream of pageshow events handled by this Window.

onPause Stream<Event>
read-only

onPlay Stream<Event>
read-only

onPlaying Stream<Event>
read-only

onPopState Stream<PopStateEvent>
read-only

Stream of popstate events handled by this Window.

onProgress Stream<Event>
read-only

onRateChange Stream<Event>
read-only

onReset Stream<Event>
read-only

Stream of reset events handled by this Window.

onResize Stream<Event>
read-only

Stream of resize events handled by this Window.

onScroll Stream<Event>
read-only

Stream of scroll events handled by this Window.

onSearch Stream<Event>
read-only

Stream of search events handled by this Window.

onSeeked Stream<Event>
read-only

onSeeking Stream<Event>
read-only

onSelect Stream<Event>
read-only

Stream of select events handled by this Window.

onStalled Stream<Event>
read-only

onStorage Stream<StorageEvent>
read-only

Stream of storage events handled by this Window.

onSubmit Stream<Event>
read-only

Stream of submit events handled by this Window.

onSuspend Stream<Event>
read-only

onTimeUpdate Stream<Event>
read-only

onTouchCancel Stream<TouchEvent>
read-only

Stream of touchcancel events handled by this Window.

onTouchEnd Stream<TouchEvent>
read-only

Stream of touchend events handled by this Window.

onTouchMove Stream<TouchEvent>
read-only

Stream of touchmove events handled by this Window.

onTouchStart Stream<TouchEvent>
read-only

Stream of touchstart events handled by this Window.

onTransitionEnd Stream<TransitionEvent>
read-only

Stream of transitionend events handled by this Window.

onUnload Stream<Event>
read-only

Stream of unload events handled by this Window.

onVolumeChange Stream<Event>
read-only

onWaiting Stream<Event>
read-only

opener WindowBase
read / write

orientation int
read-only

outerHeight int
read-only

The height of this window including all user interface elements.

outerWidth int
read-only

The width of the window including all user interface elements.

pageXOffset int
read-only

pageYOffset int
read-only

parent WindowBase
read-only

performance Performance
read-only

Timing and navigation data for this window.

screen Screen
read-only

Information about the screen displaying this window.

screenLeft int
read-only

The distance from the left side of the screen to the left side of this window.

screenTop int
read-only

The distance from the top of the screen to the top of this window.

screenX int
read-only

The distance from the left side of the screen to the mouse pointer.

screenY int
read-only

The distance from the top of the screen to the mouse pointer.

scrollbars BarProp
read-only

This window's scroll bars.

scrollX int
read-only

scrollY int
read-only

self WindowBase
read-only

The current window.

sessionStorage Storage
read-only

Storage for this window that is cleared when this session ends.

speechSynthesis SpeechSynthesis
read-only

Access to speech synthesis in the browser.

status String
read / write

Deprecated*.

statusbar BarProp
read-only

This window's status bar.

styleMedia StyleMedia
read-only

Access to CSS media queries.

toolbar BarProp
read-only

This window's tool bar.

top WindowBase
read-only

window WindowBase
read-only

The current window.

Methods

addEventListener(String type, dynamic listener(Event event), [bool useCapture]) → void
inherited

alert([String message]) → void

atob(String string) → String

btoa(String string) → String

cancelAnimationFrame(int id) → void

close() → void

Closes the window.

confirm([String message]) → bool

dispatchEvent(Event event) → bool
inherited

find(String string, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) → bool

Finds text in this window.

getMatchedCssRules(Element element, String pseudoElement) → List<CssRule>

Returns all CSS rules that apply to the element's pseudo-element.

getSelection() → Selection

Returns the currently selected text.

matchMedia(String query) → MediaQueryList

Returns a list of media queries for the given query string.

moveBy(num x, num y) → void

Moves this window.

moveTo(Point p) → void

Moves this window to a specific position.

open(String url, String name, [String options]) → WindowBase

openDatabase(String name, String version, String displayName, int estimatedSize, [void creationCallback(SqlDatabase database)]) → SqlDatabase

postMessage(message, String targetOrigin, [List<MessagePort> transfer]) → void

Sends a cross-origin message.

print() → void

Opens the print dialog for this window.

removeEventListener(String type, dynamic listener(Event event), [bool useCapture]) → void
inherited

requestAnimationFrame(void callback(num highResTime)) → int

Called to draw an animation frame and then request the window to repaint after callback has finished (creating the animation).

requestFileSystem(int size, {bool persistent: false}) → Future<FileSystem>

Access a sandboxed file system of the specified size. If persistent is true, the application will request permission from the user to create lasting storage. This storage cannot be freed without the user's permission. Returns a Future whose value stores a reference to the sandboxed file system for use. Because the file system is sandboxed, applications cannot access file systems created in other web pages.

resizeBy(num x, num y) → void

Resizes this window by an offset.

resizeTo(num width, num height) → void

Resizes this window to a specific width and height.

resolveLocalFileSystemUrl(String url) → Future<Entry>

scroll(x, y, [Map scrollOptions]) → void

scrollBy(x, y, [Map scrollOptions]) → void

scrollTo(x, y, [Map scrollOptions]) → void

showModalDialog(String url, [Object dialogArgs, String featureArgs]) → Object

Opens a new page as a modal dialog.

stop() → void

Stops the window from loading.