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
- DOM Window from MDN.
- Window from the W3C.
- Annotations
- DocsEditable()
- DomName('Window')
- Extends
- Object
- EventTarget
- Window
- Implements
Constants
-
EventStreamProvider<AnimationEvent>
animationEndEvent
=
const EventStreamProvider<AnimationEvent>
('webkitAnimationEnd') -
constStatic factory designed to expose
animationend
events to event handlers that are not necessarily instances of Window. -
EventStreamProvider<AnimationEvent>
animationIterationEvent
=
const EventStreamProvider<AnimationEvent>
('webkitAnimationIteration') -
constStatic factory designed to expose
animationiteration
events to event handlers that are not necessarily instances of Window. -
EventStreamProvider<AnimationEvent>
animationStartEvent
=
const EventStreamProvider<AnimationEvent>
('webkitAnimationStart') -
constStatic factory designed to expose
animationstart
events to event handlers that are not necessarily instances of Window. - EventStreamProvider<BeforeUnloadEvent> beforeUnloadEvent = const _BeforeUnloadEventStreamProvider<BeforeUnloadEvent>('beforeunload')
-
constStatic factory designed to expose
beforeunload
events to event handlers that are not necessarily instances of Window. -
EventStreamProvider<Event>
contentLoadedEvent
=
const EventStreamProvider<Event>
('DOMContentLoaded') -
constStatic factory designed to expose
contentloaded
events to event handlers that are not necessarily instances of Window. -
EventStreamProvider<DeviceMotionEvent>
deviceMotionEvent
=
const EventStreamProvider<DeviceMotionEvent>
('devicemotion') -
constStatic factory designed to expose
devicemotion
events to event handlers that are not necessarily instances of Window. -
EventStreamProvider<DeviceOrientationEvent>
deviceOrientationEvent
=
const EventStreamProvider<DeviceOrientationEvent>
('deviceorientation') -
constStatic factory designed to expose
deviceorientation
events to event handlers that are not necessarily instances of Window. -
EventStreamProvider<Event>
hashChangeEvent
=
const EventStreamProvider<Event>
('hashchange') -
constStatic 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') -
constStatic factory designed to expose
message
events to event handlers that are not necessarily instances of Window. -
EventStreamProvider<Event>
offlineEvent
=
const EventStreamProvider<Event>
('offline') -
constStatic factory designed to expose
offline
events to event handlers that are not necessarily instances of Window. -
EventStreamProvider<Event>
onlineEvent
=
const EventStreamProvider<Event>
('online') -
constStatic factory designed to expose
online
events to event handlers that are not necessarily instances of Window. -
EventStreamProvider<Event>
pageHideEvent
=
const EventStreamProvider<Event>
('pagehide') -
constStatic factory designed to expose
pagehide
events to event handlers that are not necessarily instances of Window. -
EventStreamProvider<Event>
pageShowEvent
=
const EventStreamProvider<Event>
('pageshow') -
constStatic factory designed to expose
pageshow
events to event handlers that are not necessarily instances of Window. - int PERSISTENT = 1
-
constIndicates that file system data cannot be cleared unless given user permission.
-
EventStreamProvider<PopStateEvent>
popStateEvent
=
const EventStreamProvider<PopStateEvent>
('popstate') -
constStatic 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') -
constStatic factory designed to expose
storage
events to event handlers that are not necessarily instances of Window. - int TEMPORARY = 0
-
constIndicates that file system data can be cleared at any time.
-
EventStreamProvider<Event>
unloadEvent
=
const EventStreamProvider<Event>
('unload') -
constStatic factory designed to expose
unload
events to event handlers that are not necessarily instances of Window.
Static Properties
- bool supportsPointConversions
-
read-onlyconvertPointFromNodeToPage and convertPointFromPageToNode are removed. see http://dev.w3.org/csswg/cssom-view/#geometry
Properties
- Future<num> animationFrame
-
read-onlyReturns a Future that completes just before the window is about to repaint so the user can draw an animation frame.
- ApplicationCache applicationCache
-
read-onlyThe application cache for this window.
- bool closed
-
read-only
- Console console
-
read-only
- Crypto crypto
-
read-onlyEntrypoint for the browser's cryptographic functions.
- Css css
-
read-onlyEntrypoint for CSS-related functions.
- String defaultstatus
-
read / writeDeprecated.
- String defaultStatus
-
read / writeDeprecated.
- double devicePixelRatio
-
read-onlyThe ratio between physical pixels and logical CSS pixels.
- Document document
-
read-only
- History history
-
read-onlyThe current session history for this window's newest document.
- IdbFactory indexedDB
-
read-only
- int innerHeight
-
read-onlyThe height of the viewport including scrollbars.
- int innerWidth
-
read-onlyThe width of the viewport including scrollbars.
- Storage localStorage
-
read-onlyStorage for this window that persists across sessions.
- Location location
-
read-only
- BarProp locationbar
-
read-onlyThis window's location bar, which displays the URL.
-
read-onlyThis window's menu bar, which displays menu commands.
- String name
-
read / writeThe name of this window.
-
read-onlyThe user agent accessing this window.
- bool offscreenBuffering
-
read-onlyWhether objects are drawn offscreen before being displayed.
- Events on
-
read-only, inheritedThis is an ease-of-use accessor for event streams which should only be used when an explicit accessor is not available.
- Stream<Event> onAbort
-
read-onlyStream of
abort
events handled by thisWindow
. - Stream<AnimationEvent> onAnimationEnd
-
read-onlyStream of
animationend
events handled by thisWindow
. - Stream<AnimationEvent> onAnimationIteration
-
read-onlyStream of
animationiteration
events handled by thisWindow
. - Stream<AnimationEvent> onAnimationStart
-
read-onlyStream of
animationstart
events handled by thisWindow
. - Stream<Event> onBeforeUnload
-
read-onlyStream of
beforeunload
events handled by thisWindow
. - Stream<Event> onBlur
-
read-onlyStream of
blur
events handled by thisWindow
. - Stream<Event> onCanPlay
-
read-only
- Stream<Event> onCanPlayThrough
-
read-only
- Stream<Event> onChange
-
read-onlyStream of
change
events handled by thisWindow
. - Stream<MouseEvent> onClick
-
read-onlyStream of
click
events handled by thisWindow
. - Stream<Event> onContentLoaded
-
read-onlyStream of
contentloaded
events handled by thisWindow
. - Stream<MouseEvent> onContextMenu
-
read-onlyStream of
contextmenu
events handled by thisWindow
. - Stream<DeviceMotionEvent> onDeviceMotion
-
read-onlyStream of
devicemotion
events handled by thisWindow
. - Stream<DeviceOrientationEvent> onDeviceOrientation
-
read-onlyStream of
deviceorientation
events handled by thisWindow
. - Stream<Event> onDoubleClick
-
read-onlyStream of
doubleclick
events handled by thisWindow
. - Stream<MouseEvent> onDrag
-
read-onlyStream of
drag
events handled by thisWindow
. - Stream<MouseEvent> onDragEnd
-
read-onlyStream of
dragend
events handled by thisWindow
. - Stream<MouseEvent> onDragEnter
-
read-onlyStream of
dragenter
events handled by thisWindow
. - Stream<MouseEvent> onDragLeave
-
read-onlyStream of
dragleave
events handled by thisWindow
. - Stream<MouseEvent> onDragOver
-
read-onlyStream of
dragover
events handled by thisWindow
. - Stream<MouseEvent> onDragStart
-
read-onlyStream of
dragstart
events handled by thisWindow
. - Stream<MouseEvent> onDrop
-
read-onlyStream of
drop
events handled by thisWindow
. - Stream<Event> onDurationChange
-
read-only
- Stream<Event> onEmptied
-
read-only
- Stream<Event> onEnded
-
read-only
- Stream<Event> onError
-
read-onlyStream of
error
events handled by thisWindow
. - Stream<Event> onFocus
-
read-onlyStream of
focus
events handled by thisWindow
. - Stream<Event> onHashChange
-
read-onlyStream of
hashchange
events handled by thisWindow
. - Stream<Event> onInput
-
read-onlyStream of
input
events handled by thisWindow
. - Stream<Event> onInvalid
-
read-onlyStream of
invalid
events handled by thisWindow
. - Stream<KeyboardEvent> onKeyDown
-
read-onlyStream of
keydown
events handled by thisWindow
. - Stream<KeyboardEvent> onKeyPress
-
read-onlyStream of
keypress
events handled by thisWindow
. - Stream<KeyboardEvent> onKeyUp
-
read-onlyStream of
keyup
events handled by thisWindow
. - Stream<Event> onLoad
-
read-onlyStream of
load
events handled by thisWindow
. - Stream<Event> onLoadedData
-
read-only
- Stream<Event> onLoadedMetadata
-
read-only
- Stream<Event> onLoadStart
-
read-only
- Stream<MessageEvent> onMessage
-
read-onlyStream of
message
events handled by thisWindow
. - Stream<MouseEvent> onMouseDown
-
read-onlyStream of
mousedown
events handled by thisWindow
. - Stream<MouseEvent> onMouseEnter
-
read-onlyStream of
mouseenter
events handled by thisWindow
. - Stream<MouseEvent> onMouseLeave
-
read-onlyStream of
mouseleave
events handled by thisWindow
. - Stream<MouseEvent> onMouseMove
-
read-onlyStream of
mousemove
events handled by thisWindow
. - Stream<MouseEvent> onMouseOut
-
read-onlyStream of
mouseout
events handled by thisWindow
. - Stream<MouseEvent> onMouseOver
-
read-onlyStream of
mouseover
events handled by thisWindow
. - Stream<MouseEvent> onMouseUp
-
read-onlyStream of
mouseup
events handled by thisWindow
. - Stream<WheelEvent> onMouseWheel
-
read-onlyStream of
mousewheel
events handled by thisWindow
. - Stream<Event> onOffline
-
read-onlyStream of
offline
events handled by thisWindow
. - Stream<Event> onOnline
-
read-onlyStream of
online
events handled by thisWindow
. - Stream<Event> onPageHide
-
read-onlyStream of
pagehide
events handled by thisWindow
. - Stream<Event> onPageShow
-
read-onlyStream of
pageshow
events handled by thisWindow
. - Stream<Event> onPause
-
read-only
- Stream<Event> onPlay
-
read-only
- Stream<Event> onPlaying
-
read-only
- Stream<PopStateEvent> onPopState
-
read-onlyStream of
popstate
events handled by thisWindow
. - Stream<Event> onProgress
-
read-only
- Stream<Event> onRateChange
-
read-only
- Stream<Event> onReset
-
read-onlyStream of
reset
events handled by thisWindow
. - Stream<Event> onResize
-
read-onlyStream of
resize
events handled by thisWindow
. - Stream<Event> onScroll
-
read-onlyStream of
scroll
events handled by thisWindow
. - Stream<Event> onSearch
-
read-onlyStream of
search
events handled by thisWindow
. - Stream<Event> onSeeked
-
read-only
- Stream<Event> onSeeking
-
read-only
- Stream<Event> onSelect
-
read-onlyStream of
select
events handled by thisWindow
. - Stream<Event> onStalled
-
read-only
- Stream<StorageEvent> onStorage
-
read-onlyStream of
storage
events handled by thisWindow
. - Stream<Event> onSubmit
-
read-onlyStream of
submit
events handled by thisWindow
. - Stream<Event> onSuspend
-
read-only
- Stream<Event> onTimeUpdate
-
read-only
- Stream<TouchEvent> onTouchCancel
-
read-onlyStream of
touchcancel
events handled by thisWindow
. - Stream<TouchEvent> onTouchEnd
-
read-onlyStream of
touchend
events handled by thisWindow
. - Stream<TouchEvent> onTouchMove
-
read-onlyStream of
touchmove
events handled by thisWindow
. - Stream<TouchEvent> onTouchStart
-
read-onlyStream of
touchstart
events handled by thisWindow
. - Stream<TransitionEvent> onTransitionEnd
-
read-onlyStream of
transitionend
events handled by thisWindow
. - Stream<Event> onUnload
-
read-onlyStream of
unload
events handled by thisWindow
. - Stream<Event> onVolumeChange
-
read-only
- Stream<Event> onWaiting
-
read-only
- WindowBase opener
-
read / write
- int orientation
-
read-only
- int outerHeight
-
read-onlyThe height of this window including all user interface elements.
- int outerWidth
-
read-onlyThe width of the window including all user interface elements.
- int pageXOffset
-
read-only
- int pageYOffset
-
read-only
- WindowBase parent
-
read-only
- Performance performance
-
read-onlyTiming and navigation data for this window.
- Screen screen
-
read-onlyInformation about the screen displaying this window.
- int screenLeft
-
read-onlyThe distance from the left side of the screen to the left side of this window.
- int screenTop
-
read-onlyThe distance from the top of the screen to the top of this window.
- int screenX
-
read-onlyThe distance from the left side of the screen to the mouse pointer.
- int screenY
-
read-onlyThe distance from the top of the screen to the mouse pointer.
- BarProp scrollbars
-
read-onlyThis window's scroll bars.
- int scrollX
-
read-only
- int scrollY
-
read-only
- WindowBase self
-
read-onlyThe current window.
- Storage sessionStorage
-
read-onlyStorage for this window that is cleared when this session ends.
- SpeechSynthesis speechSynthesis
-
read-onlyAccess to speech synthesis in the browser.
- String status
-
read / writeDeprecated.
- BarProp statusbar
-
read-onlyThis window's status bar.
- StyleMedia styleMedia
-
read-onlyAccess to CSS media queries.
- BarProp toolbar
-
read-onlyThis window's tool bar.
- WindowBase top
-
read-only
- WindowBase window
-
read-onlyThe 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
. Ifpersistent
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 aFuture
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.