Window class

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

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

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

Constants

contentLoadedEvent = const EventStreamProvider<Event>('DOMContentLoaded')
Static factory designed to expose contentloaded events to event handlers that are not necessarily instances of Window.
deviceMotionEvent = const EventStreamProvider<DeviceMotionEvent>('devicemotion')
Static factory designed to expose devicemotion events to event handlers that are not necessarily instances of Window.
deviceOrientationEvent = const EventStreamProvider<DeviceOrientationEvent>('deviceorientation')
Static factory designed to expose deviceorientation events to event handlers that are not necessarily instances of Window.
hashChangeEvent = const EventStreamProvider<Event>('hashchange')
Static factory designed to expose hashchange events to event handlers that are not necessarily instances of Window.
loadStartEvent = const EventStreamProvider<Event>('loadstart')
messageEvent = const EventStreamProvider<MessageEvent>('message')
Static factory designed to expose message events to event handlers that are not necessarily instances of Window.
offlineEvent = const EventStreamProvider<Event>('offline')
Static factory designed to expose offline events to event handlers that are not necessarily instances of Window.
onlineEvent = const EventStreamProvider<Event>('online')
Static factory designed to expose online events to event handlers that are not necessarily instances of Window.
pageHideEvent = const EventStreamProvider<Event>('pagehide')
Static factory designed to expose pagehide events to event handlers that are not necessarily instances of Window.
pageShowEvent = const EventStreamProvider<Event>('pageshow')
Static factory designed to expose pageshow events to event handlers that are not necessarily instances of Window.
popStateEvent = const EventStreamProvider<PopStateEvent>('popstate')
Static factory designed to expose popstate events to event handlers that are not necessarily instances of Window.
progressEvent = const EventStreamProvider<Event>('progress')
storageEvent = const EventStreamProvider<StorageEvent>('storage')
Static factory designed to expose storage events to event handlers that are not necessarily instances of Window.
unloadEvent = const EventStreamProvider<Event>('unload')
Static factory designed to expose unload events to event handlers that are not necessarily instances of Window.
animationEndEvent = const EventStreamProvider<AnimationEvent>('webkitAnimationEnd')
Static factory designed to expose animationend events to event handlers that are not necessarily instances of Window.
animationIterationEvent = const EventStreamProvider<AnimationEvent>('webkitAnimationIteration')
Static factory designed to expose animationiteration events to event handlers that are not necessarily instances of Window.
animationStartEvent = const EventStreamProvider<AnimationEvent>('webkitAnimationStart')
Static factory designed to expose animationstart events to event handlers that are not necessarily instances of Window.
PERSISTENT = 1
Indicates that file system data cannot be cleared unless given user permission.
TEMPORARY = 0
Indicates that file system data can be cleared at any time.
beforeUnloadEvent = const _BeforeUnloadEventStreamProvider<BeforeUnloadEvent>('beforeunload')
Static factory designed to expose beforeunload events to event handlers that are not necessarily instances of Window.

Static Properties

supportsPointConversions bool
read-only

Instance Properties

animationFrame Future<num>
read-only
css Css
read-only
applicationCache ApplicationCache
read-only
closed bool
read-only
console Console
read-only
crypto Crypto
read-only
defaultStatus String
read / write
defaultstatus String
read / write
devicePixelRatio double
read-only
document Document
read-only
history History
read-only
indexedDB IdbFactory
read-only
innerHeight int
read-only
innerWidth int
read-only
localStorage Storage
read-only
location Location
read-only
locationbar BarProp
read-only
read-only
name String
read / write
read-only
offscreenBuffering bool
read-only
opener WindowBase
read / write
orientation int
read-only
outerHeight int
read-only
outerWidth int
read-only
parent WindowBase
read-only
performance Performance
read-only
screen Screen
read-only
screenLeft int
read-only
screenTop int
read-only
screenX int
read-only
screenY int
read-only
scrollbars BarProp
read-only
self WindowBase
read-only
sessionStorage Storage
read-only
speechSynthesis SpeechSynthesis
read-only
status String
read / write
statusbar BarProp
read-only
styleMedia StyleMedia
read-only
toolbar BarProp
read-only
top WindowBase
read-only
window WindowBase
read-only
onContentLoaded Stream<Event>
read-only
onAbort Stream<Event>
read-only
onBlur Stream<Event>
read-only
onCanPlay Stream<Event>
read-only
onCanPlayThrough Stream<Event>
read-only
onChange Stream<Event>
read-only
onClick Stream<MouseEvent>
read-only
onContextMenu Stream<MouseEvent>
read-only
onDoubleClick Stream<Event>
read-only
onDeviceMotion Stream<DeviceMotionEvent>
read-only
onDeviceOrientation Stream<DeviceOrientationEvent>
read-only
onDrag Stream<MouseEvent>
read-only
onDragEnd Stream<MouseEvent>
read-only
onDragEnter Stream<MouseEvent>
read-only
onDragLeave Stream<MouseEvent>
read-only
onDragOver Stream<MouseEvent>
read-only
onDragStart Stream<MouseEvent>
read-only
onDrop Stream<MouseEvent>
read-only
onDurationChange Stream<Event>
read-only
onEmptied Stream<Event>
read-only
onEnded Stream<Event>
read-only
onError Stream<Event>
read-only
onFocus Stream<Event>
read-only
onHashChange Stream<Event>
read-only
onInput Stream<Event>
read-only
onInvalid Stream<Event>
read-only
onKeyDown Stream<KeyboardEvent>
read-only
onKeyPress Stream<KeyboardEvent>
read-only
onKeyUp Stream<KeyboardEvent>
read-only
onLoad Stream<Event>
read-only
onLoadedData Stream<Event>
read-only
onLoadedMetadata Stream<Event>
read-only
onLoadStart Stream<Event>
read-only
onMessage Stream<MessageEvent>
read-only
onMouseDown Stream<MouseEvent>
read-only
onMouseEnter Stream<MouseEvent>
read-only
onMouseLeave Stream<MouseEvent>
read-only
onMouseMove Stream<MouseEvent>
read-only
onMouseOut Stream<MouseEvent>
read-only
onMouseOver Stream<MouseEvent>
read-only
onMouseUp Stream<MouseEvent>
read-only
onMouseWheel Stream<WheelEvent>
read-only
onOffline Stream<Event>
read-only
onOnline Stream<Event>
read-only
onPageHide Stream<Event>
read-only
onPageShow Stream<Event>
read-only
onPause Stream<Event>
read-only
onPlay Stream<Event>
read-only
onPlaying Stream<Event>
read-only
onPopState Stream<PopStateEvent>
read-only
onProgress Stream<Event>
read-only
onRateChange Stream<Event>
read-only
onReset Stream<Event>
read-only
onResize Stream<Event>
read-only
onScroll Stream<Event>
read-only
onSearch Stream<Event>
read-only
onSeeked Stream<Event>
read-only
onSeeking Stream<Event>
read-only
onSelect Stream<Event>
read-only
onStalled Stream<Event>
read-only
onStorage Stream<StorageEvent>
read-only
onSubmit Stream<Event>
read-only
onSuspend Stream<Event>
read-only
onTimeUpdate Stream<Event>
read-only
onTouchCancel Stream<TouchEvent>
read-only
onTouchEnd Stream<TouchEvent>
read-only
onTouchMove Stream<TouchEvent>
read-only
onTouchStart Stream<TouchEvent>
read-only
onTransitionEnd Stream<TransitionEvent>
read-only
onUnload Stream<Event>
read-only
onVolumeChange Stream<Event>
read-only
onWaiting Stream<Event>
read-only
onAnimationEnd Stream<AnimationEvent>
read-only
onAnimationIteration Stream<AnimationEvent>
read-only
onAnimationStart Stream<AnimationEvent>
read-only
onBeforeUnload Stream<Event>
read-only
pageXOffset int
read-only
pageYOffset int
read-only
scrollX int
read-only
scrollY int
read-only
on Events Inherited
read-only

Instance Methods

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.
alert([String message]) → void
cancelAnimationFrame(int id) → void
close() → void
Closes the window.
confirm([String message]) → bool
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.
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.
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.
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.
resolveLocalFileSystemUrl(String url) → Future<Entry>
atob(String string) → String
btoa(String string) → String
moveTo(Point p) → void
Moves this window to a specific position.
addEventListener(String type, dynamic listener(Event event), [bool useCapture]) → void Inherited
removeEventListener(String type, dynamic listener(Event event), [bool useCapture]) → void Inherited
dispatchEvent(Event event) → bool Inherited