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.
- Inheritance
- Object
- DartHtmlDomObject
- EventTarget
- Window
- Implements
- Annotations
- DocsEditable()
- DomName('Window')
Constants
- animationEndEvent → EventStreamProvider<AnimationEvent>
-
Static factory designed to expose
animationendevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<AnimationEvent>('webkitAnimationEnd') - animationIterationEvent → EventStreamProvider<AnimationEvent>
-
Static factory designed to expose
animationiterationevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<AnimationEvent>('webkitAnimationIteration') - animationStartEvent → EventStreamProvider<AnimationEvent>
-
Static factory designed to expose
animationstartevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<AnimationEvent>('webkitAnimationStart') - beforeUnloadEvent → EventStreamProvider<BeforeUnloadEvent>
-
Static factory designed to expose
beforeunloadevents to event handlers that are not necessarily instances of Window.…constconst _BeforeUnloadEventStreamProvider<BeforeUnloadEvent>('beforeunload') - contentLoadedEvent → EventStreamProvider<Event>
-
Static factory designed to expose
contentloadedevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<Event>('DOMContentLoaded') - deviceMotionEvent → EventStreamProvider<DeviceMotionEvent>
-
Static factory designed to expose
devicemotionevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<DeviceMotionEvent>('devicemotion') - deviceOrientationEvent → EventStreamProvider<DeviceOrientationEvent>
-
Static factory designed to expose
deviceorientationevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<DeviceOrientationEvent>('deviceorientation') - hashChangeEvent → EventStreamProvider<Event>
-
Static factory designed to expose
hashchangeevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<Event>('hashchange') - loadStartEvent → EventStreamProvider<Event>
-
const
const EventStreamProvider<Event>('loadstart') - messageEvent → EventStreamProvider<MessageEvent>
-
Static factory designed to expose
messageevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<MessageEvent>('message') - offlineEvent → EventStreamProvider<Event>
-
Static factory designed to expose
offlineevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<Event>('offline') - onlineEvent → EventStreamProvider<Event>
-
Static factory designed to expose
onlineevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<Event>('online') - pageHideEvent → EventStreamProvider<Event>
-
Static factory designed to expose
pagehideevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<Event>('pagehide') - pageShowEvent → EventStreamProvider<Event>
-
Static factory designed to expose
pageshowevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<Event>('pageshow') - PERSISTENT → int
-
Indicates that file system data cannot be cleared unless given user permission.…
const1 - popStateEvent → EventStreamProvider<PopStateEvent>
-
Static factory designed to expose
popstateevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<PopStateEvent>('popstate') - progressEvent → EventStreamProvider<Event>
-
const
const EventStreamProvider<Event>('progress') - storageEvent → EventStreamProvider<StorageEvent>
-
Static factory designed to expose
storageevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<StorageEvent>('storage') - TEMPORARY → int
-
Indicates that file system data can be cleared at any time.…
const0 - unloadEvent → EventStreamProvider<Event>
-
Static factory designed to expose
unloadevents to event handlers that are not necessarily instances of Window.…constconst EventStreamProvider<Event>('unload')
Static Properties
- supportsPointConversions → bool
-
convertPointFromNodeToPage and convertPointFromPageToNode are removed. see http://dev.w3.org/csswg/cssom-view/#geometry
read-only
Static Methods
Constructors
Properties
- animationFrame → Future<num>
-
Returns a Future that completes just before the window is about to repaint so the user can draw an animation frame.…
read-only - applicationCache → ApplicationCache
-
The application cache for this window.…
read-only - blink_jsObject → JsObject
-
The underlying JS DOM object.
read / write, inherited - closed → bool
-
read-only
- console → Console
-
read-only
- crypto → Crypto
-
Entrypoint for the browser's cryptographic functions.…
read-only - css → Css
-
Entrypoint for CSS-related functions.…
read-only - defaultStatus → String
-
Deprecated*.…
read / write - defaultstatus → String
-
Deprecated*.…
read / write - devicePixelRatio → num
-
The ratio between physical pixels and logical CSS pixels.…
read-only - document → Document
-
read-only
- hashCode → int
-
read-only, inherited
- history → History
-
The current session history for this window's newest document.…
read-only - indexedDB → IdbFactory
-
read-only
- innerHeight → int
-
The height of the viewport including scrollbars.…
read-only - innerWidth → int
-
The width of the viewport including scrollbars.…
read-only - localStorage → Storage
-
Storage for this window that persists across sessions.…
read-only - location → Location
-
read-only
- locationbar → BarProp
-
This window's location bar, which displays the URL.…
read-only -
This window's menu bar, which displays menu commands.…
read-only - name → String
-
The name of this window.…
read / write -
The user agent accessing this window.…
read-only - offscreenBuffering → bool
-
Whether objects are drawn offscreen before being displayed.…
read-only - on → Events
-
This is an ease-of-use accessor for event streams which should only be used when an explicit accessor is not available.
read-only, inherited - onAbort → Stream<Event>
-
Stream of
abortevents handled by thisWindow.read-only - onAnimationEnd → Stream<AnimationEvent>
-
Stream of
animationendevents handled by thisWindow.read-only - onAnimationIteration → Stream<AnimationEvent>
-
Stream of
animationiterationevents handled by thisWindow.read-only - onAnimationStart → Stream<AnimationEvent>
-
Stream of
animationstartevents handled by thisWindow.read-only - onBeforeUnload → Stream<Event>
-
Stream of
beforeunloadevents handled by thisWindow.read-only - onBlur → Stream<Event>
-
Stream of
blurevents handled by thisWindow.read-only - onCanPlay → Stream<Event>
-
read-only
- onCanPlayThrough → Stream<Event>
-
read-only
- onChange → Stream<Event>
-
Stream of
changeevents handled by thisWindow.read-only - onClick → Stream<MouseEvent>
-
Stream of
clickevents handled by thisWindow.read-only - onContentLoaded → Stream<Event>
-
Stream of
contentloadedevents handled by thisWindow.read-only - onContextMenu → Stream<MouseEvent>
-
Stream of
contextmenuevents handled by thisWindow.read-only - onDeviceMotion → Stream<DeviceMotionEvent>
-
Stream of
devicemotionevents handled by thisWindow.read-only - onDeviceOrientation → Stream<DeviceOrientationEvent>
-
Stream of
deviceorientationevents handled by thisWindow.read-only - onDoubleClick → Stream<Event>
-
Stream of
doubleclickevents handled by thisWindow.read-only - onDrag → Stream<MouseEvent>
-
Stream of
dragevents handled by thisWindow.read-only - onDragEnd → Stream<MouseEvent>
-
Stream of
dragendevents handled by thisWindow.read-only - onDragEnter → Stream<MouseEvent>
-
Stream of
dragenterevents handled by thisWindow.read-only - onDragLeave → Stream<MouseEvent>
-
Stream of
dragleaveevents handled by thisWindow.read-only - onDragOver → Stream<MouseEvent>
-
Stream of
dragoverevents handled by thisWindow.read-only - onDragStart → Stream<MouseEvent>
-
Stream of
dragstartevents handled by thisWindow.read-only - onDrop → Stream<MouseEvent>
-
Stream of
dropevents handled by thisWindow.read-only - onDurationChange → Stream<Event>
-
read-only
- onEmptied → Stream<Event>
-
read-only
- onEnded → Stream<Event>
-
read-only
- onError → Stream<Event>
-
Stream of
errorevents handled by thisWindow.read-only - onFocus → Stream<Event>
-
Stream of
focusevents handled by thisWindow.read-only - onHashChange → Stream<Event>
-
Stream of
hashchangeevents handled by thisWindow.read-only - onInput → Stream<Event>
-
Stream of
inputevents handled by thisWindow.read-only - onInvalid → Stream<Event>
-
Stream of
invalidevents handled by thisWindow.read-only - onKeyDown → Stream<KeyboardEvent>
-
Stream of
keydownevents handled by thisWindow.read-only - onKeyPress → Stream<KeyboardEvent>
-
Stream of
keypressevents handled by thisWindow.read-only - onKeyUp → Stream<KeyboardEvent>
-
Stream of
keyupevents handled by thisWindow.read-only - onLoad → Stream<Event>
-
Stream of
loadevents handled by thisWindow.read-only - onLoadedData → Stream<Event>
-
read-only
- onLoadedMetadata → Stream<Event>
-
read-only
- onLoadStart → Stream<Event>
-
read-only
- onMessage → Stream<MessageEvent>
-
Stream of
messageevents handled by thisWindow.read-only - onMouseDown → Stream<MouseEvent>
-
Stream of
mousedownevents handled by thisWindow.read-only - onMouseEnter → Stream<MouseEvent>
-
Stream of
mouseenterevents handled by thisWindow.read-only - onMouseLeave → Stream<MouseEvent>
-
Stream of
mouseleaveevents handled by thisWindow.read-only - onMouseMove → Stream<MouseEvent>
-
Stream of
mousemoveevents handled by thisWindow.read-only - onMouseOut → Stream<MouseEvent>
-
Stream of
mouseoutevents handled by thisWindow.read-only - onMouseOver → Stream<MouseEvent>
-
Stream of
mouseoverevents handled by thisWindow.read-only - onMouseUp → Stream<MouseEvent>
-
Stream of
mouseupevents handled by thisWindow.read-only - onMouseWheel → Stream<WheelEvent>
-
Stream of
mousewheelevents handled by thisWindow.read-only - onOffline → Stream<Event>
-
Stream of
offlineevents handled by thisWindow.read-only - onOnline → Stream<Event>
-
Stream of
onlineevents handled by thisWindow.read-only - onPageHide → Stream<Event>
-
Stream of
pagehideevents handled by thisWindow.read-only - onPageShow → Stream<Event>
-
Stream of
pageshowevents handled by thisWindow.read-only - onPause → Stream<Event>
-
read-only
- onPlay → Stream<Event>
-
read-only
- onPlaying → Stream<Event>
-
read-only
- onPopState → Stream<PopStateEvent>
-
Stream of
popstateevents handled by thisWindow.read-only - onProgress → Stream<Event>
-
read-only
- onRateChange → Stream<Event>
-
read-only
- onReset → Stream<Event>
-
Stream of
resetevents handled by thisWindow.read-only - onResize → Stream<Event>
-
Stream of
resizeevents handled by thisWindow.read-only - onScroll → Stream<Event>
-
Stream of
scrollevents handled by thisWindow.read-only - onSearch → Stream<Event>
-
Stream of
searchevents handled by thisWindow.read-only - onSeeked → Stream<Event>
-
read-only
- onSeeking → Stream<Event>
-
read-only
- onSelect → Stream<Event>
-
Stream of
selectevents handled by thisWindow.read-only - onStalled → Stream<Event>
-
read-only
- onStorage → Stream<StorageEvent>
-
Stream of
storageevents handled by thisWindow.read-only - onSubmit → Stream<Event>
-
Stream of
submitevents handled by thisWindow.read-only - onSuspend → Stream<Event>
-
read-only
- onTimeUpdate → Stream<Event>
-
read-only
- onTouchCancel → Stream<TouchEvent>
-
Stream of
touchcancelevents handled by thisWindow.read-only - onTouchEnd → Stream<TouchEvent>
-
Stream of
touchendevents handled by thisWindow.read-only - onTouchMove → Stream<TouchEvent>
-
Stream of
touchmoveevents handled by thisWindow.read-only - onTouchStart → Stream<TouchEvent>
-
Stream of
touchstartevents handled by thisWindow.read-only - onTransitionEnd → Stream<TransitionEvent>
-
Stream of
transitionendevents handled by thisWindow.read-only - onUnload → Stream<Event>
-
Stream of
unloadevents handled by thisWindow.read-only - onVolumeChange → Stream<Event>
-
read-only
- onWaiting → Stream<Event>
-
read-only
- opener → WindowBase
-
read / write
- orientation → int
-
read-only
- outerHeight → int
-
The height of this window including all user interface elements.…
read-only - outerWidth → int
-
The width of the window including all user interface elements.…
read-only - pageXOffset → int
-
read-only
- pageYOffset → int
-
read-only
- parent → WindowBase
-
read-only
- performance → Performance
-
Timing and navigation data for this window.…
read-only - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited - screen → Screen
-
Information about the screen displaying this window.…
read-only - screenLeft → int
-
The distance from the left side of the screen to the left side of this window.…
read-only - screenTop → int
-
The distance from the top of the screen to the top of this window.…
read-only - screenX → int
-
The distance from the left side of the screen to the mouse pointer.…
read-only - screenY → int
-
The distance from the top of the screen to the mouse pointer.…
read-only - scrollbars → BarProp
-
This window's scroll bars.…
read-only - scrollX → int
-
read-only
- scrollY → int
-
read-only
- self → WindowBase
-
The current window.…
read-only - sessionStorage → Storage
-
Storage for this window that is cleared when this session ends.…
read-only - speechSynthesis → SpeechSynthesis
-
Access to speech synthesis in the browser.…
read-only - status → String
-
Deprecated*.…
read / write - statusbar → BarProp
-
This window's status bar.…
read-only - styleMedia → StyleMedia
-
Access to CSS media queries.…
read-only - toolbar → BarProp
-
This window's tool bar.…
read-only - top → WindowBase
-
read-only
- window → WindowBase
-
The current window.…
read-only
Operators
-
operator ==(
other) → bool -
The equality operator.…
inherited
Methods
-
addEventListener(
String type, EventListener 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.…
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.…
inherited -
open(
String url, String name, [String options]) → WindowBase -
openDatabase(
String name, String version, String displayName, int estimatedSize, [DatabaseCallback 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, EventListener listener(Event event), [bool useCapture]) → void -
inherited
-
requestAnimationFrame(
RequestAnimationFrameCallback callback(num highResTime)) → int -
Called to draw an animation frame and then request the window to repaint after
callbackhas finished (creating the animation).… -
requestFileSystem(
int size, {bool persistent: false}) → Future<FileSystem> -
Access a sandboxed file system of the specified
size. Ifpersistentis 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.…
-
toString(
) → String -
Returns a string representation of this object.
inherited