class
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

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.
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.
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.
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.
int PERSISTENT = 1
const
Indicates that file system data cannot be cleared unless given user permission.
int TEMPORARY = 0
const
Indicates that file system data can be cleared at any time.
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.

Static Properties

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

Properties

Future<num> animationFrame
read-only
Returns a Future that completes just before the window is about to repaint so the user can draw an animation frame.
Css css
read-only
Entrypoint for CSS-related functions.
ApplicationCache applicationCache
read-only
The application cache for this window.
bool closed
read-only
Console console
read-only
Crypto crypto
read-only
Entrypoint for the browser's cryptographic functions.
String defaultStatus
read / write
Deprecated.
String defaultstatus
read / write
Deprecated.
double devicePixelRatio
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.
IdbFactory indexedDB
read-only
int innerHeight
read-only
The height of the viewport including scrollbars.
int innerWidth
read-only
The width of the viewport including scrollbars.
Storage localStorage
read-only
Storage for this window that persists across sessions.
Location location
read-only
BarProp locationbar
read-only
This window's location bar, which displays the URL.
read-only
This window's menu bar, which displays menu commands.
String name
read / write
The name of this window.
read-only
The user agent accessing this window.
bool offscreenBuffering
read-only
Whether objects are drawn offscreen before being displayed.
WindowBase opener
read / write
int orientation
read-only
int outerHeight
read-only
The height of this window including all user interface elements.
int outerWidth
read-only
The width of the window including all user interface elements.
WindowBase parent
read-only
Performance performance
read-only
Timing and navigation data for this window.
Screen screen
read-only
Information about the screen displaying this window.
int screenLeft
read-only
The distance from the left side of the screen to the left side of this window.
int screenTop
read-only
The distance from the top of the screen to the top of this window.
int screenX
read-only
The distance from the left side of the screen to the mouse pointer.
int screenY
read-only
The distance from the top of the screen to the mouse pointer.
BarProp scrollbars
read-only
This window's scroll bars.
WindowBase self
read-only
The current window.
Storage sessionStorage
read-only
Storage for this window that is cleared when this session ends.
SpeechSynthesis speechSynthesis
read-only
Access to speech synthesis in the browser.
String status
read / write
Deprecated.
BarProp statusbar
read-only
This window's status bar.
StyleMedia styleMedia
read-only
Access to CSS media queries.
BarProp toolbar
read-only
This window's tool bar.
WindowBase top
read-only
WindowBase window
read-only
The current window.
Stream<Event> onContentLoaded
read-only
Stream of contentloaded events handled by this [Window].
Stream<Event> onAbort
read-only
Stream of abort events handled by this [Window].
Stream<Event> onBlur
read-only
Stream of blur events handled by this [Window].
Stream<Event> onCanPlay
read-only
Stream<Event> onCanPlayThrough
read-only
Stream<Event> onChange
read-only
Stream of change events handled by this [Window].
Stream<MouseEvent> onClick
read-only
Stream of click events handled by this [Window].
Stream<MouseEvent> onContextMenu
read-only
Stream of contextmenu events handled by this [Window].
Stream<Event> onDoubleClick
read-only
Stream of doubleclick events handled by this [Window].
Stream<DeviceMotionEvent> onDeviceMotion
read-only
Stream of devicemotion events handled by this [Window].
Stream<DeviceOrientationEvent> onDeviceOrientation
read-only
Stream of deviceorientation events handled by this [Window].
Stream<MouseEvent> onDrag
read-only
Stream of drag events handled by this [Window].
Stream<MouseEvent> onDragEnd
read-only
Stream of dragend events handled by this [Window].
Stream<MouseEvent> onDragEnter
read-only
Stream of dragenter events handled by this [Window].
Stream<MouseEvent> onDragLeave
read-only
Stream of dragleave events handled by this [Window].
Stream<MouseEvent> onDragOver
read-only
Stream of dragover events handled by this [Window].
Stream<MouseEvent> onDragStart
read-only
Stream of dragstart events handled by this [Window].
Stream<MouseEvent> onDrop
read-only
Stream of drop events handled by this [Window].
Stream<Event> onDurationChange
read-only
Stream<Event> onEmptied
read-only
Stream<Event> onEnded
read-only
Stream<Event> onError
read-only
Stream of error events handled by this [Window].
Stream<Event> onFocus
read-only
Stream of focus events handled by this [Window].
Stream<Event> onHashChange
read-only
Stream of hashchange events handled by this [Window].
Stream<Event> onInput
read-only
Stream of input events handled by this [Window].
Stream<Event> onInvalid
read-only
Stream of invalid events handled by this [Window].
Stream<KeyboardEvent> onKeyDown
read-only
Stream of keydown events handled by this [Window].
Stream<KeyboardEvent> onKeyPress
read-only
Stream of keypress events handled by this [Window].
Stream<KeyboardEvent> onKeyUp
read-only
Stream of keyup events handled by this [Window].
Stream<Event> onLoad
read-only
Stream of load events handled by this [Window].
Stream<Event> onLoadedData
read-only
Stream<Event> onLoadedMetadata
read-only
Stream<Event> onLoadStart
read-only
Stream<MessageEvent> onMessage
read-only
Stream of message events handled by this [Window].
Stream<MouseEvent> onMouseDown
read-only
Stream of mousedown events handled by this [Window].
Stream<MouseEvent> onMouseEnter
read-only
Stream of mouseenter events handled by this [Window].
Stream<MouseEvent> onMouseLeave
read-only
Stream of mouseleave events handled by this [Window].
Stream<MouseEvent> onMouseMove
read-only
Stream of mousemove events handled by this [Window].
Stream<MouseEvent> onMouseOut
read-only
Stream of mouseout events handled by this [Window].
Stream<MouseEvent> onMouseOver
read-only
Stream of mouseover events handled by this [Window].
Stream<MouseEvent> onMouseUp
read-only
Stream of mouseup events handled by this [Window].
Stream<WheelEvent> onMouseWheel
read-only
Stream of mousewheel events handled by this [Window].
Stream<Event> onOffline
read-only
Stream of offline events handled by this [Window].
Stream<Event> onOnline
read-only
Stream of online events handled by this [Window].
Stream<Event> onPageHide
read-only
Stream of pagehide events handled by this [Window].
Stream<Event> onPageShow
read-only
Stream of pageshow events handled by this [Window].
Stream<Event> onPause
read-only
Stream<Event> onPlay
read-only
Stream<Event> onPlaying
read-only
Stream<PopStateEvent> onPopState
read-only
Stream of popstate events handled by this [Window].
Stream<Event> onProgress
read-only
Stream<Event> onRateChange
read-only
Stream<Event> onReset
read-only
Stream of reset events handled by this [Window].
Stream<Event> onResize
read-only
Stream of resize events handled by this [Window].
Stream<Event> onScroll
read-only
Stream of scroll events handled by this [Window].
Stream<Event> onSearch
read-only
Stream of search events handled by this [Window].
Stream<Event> onSeeked
read-only
Stream<Event> onSeeking
read-only
Stream<Event> onSelect
read-only
Stream of select events handled by this [Window].
Stream<Event> onStalled
read-only
Stream<StorageEvent> onStorage
read-only
Stream of storage events handled by this [Window].
Stream<Event> onSubmit
read-only
Stream of submit events handled by this [Window].
Stream<Event> onSuspend
read-only
Stream<Event> onTimeUpdate
read-only
Stream<TouchEvent> onTouchCancel
read-only
Stream of touchcancel events handled by this [Window].
Stream<TouchEvent> onTouchEnd
read-only
Stream of touchend events handled by this [Window].
Stream<TouchEvent> onTouchMove
read-only
Stream of touchmove events handled by this [Window].
Stream<TouchEvent> onTouchStart
read-only
Stream of touchstart events handled by this [Window].
Stream<TransitionEvent> onTransitionEnd
read-only
Stream of transitionend events handled by this [Window].
Stream<Event> onUnload
read-only
Stream of unload events handled by this [Window].
Stream<Event> onVolumeChange
read-only
Stream<Event> onWaiting
read-only
Stream<AnimationEvent> onAnimationEnd
read-only
Stream of animationend events handled by this [Window].
Stream<AnimationEvent> onAnimationIteration
read-only
Stream of animationiteration events handled by this [Window].
Stream<AnimationEvent> onAnimationStart
read-only
Stream of animationstart events handled by this [Window].
Stream<Event> onBeforeUnload
read-only
Stream of beforeunload events handled by this [Window].
int pageXOffset
read-only
int pageYOffset
read-only
int scrollX
read-only
int scrollY
read-only
Events on
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.

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