Window class - dart:html library (original) (raw)

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 WindowBaseis a representation of any window, including other tabs, windows, and frames.

See also

Other resources

Inheritance

Implemented types

Annotations

Properties

animationFrameFuture<num>

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

no setter

animationWorklet → _Worklet?

no setter

applicationCacheApplicationCache?

The application cache for this window.

no setter

audioWorklet → _Worklet?

no setter

cachesCacheStorage?

no setter

closedbool?

Indicates whether this window has been closed.

no setteroverride

consoleConsole

The debugging console for this window.

no setter

cookieStoreCookieStore?

no setter

cryptoCrypto?

Entrypoint for the browser's cryptographic functions.

no setter

customElementsCustomElementRegistry?

no setter

defaultStatusString?

Deprecated.

getter/setter pair

defaultstatusString?

Deprecated.

getter/setter pair

devicePixelRationum

The ratio between physical pixels and logical CSS pixels.

no setter

documentDocument

The newest document in this window.

no setter

externalExternal?

no setter

hashCodeint

The hash code for this object.

no setterinherited

historyHistory

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

no setteroverride

indexedDBIdbFactory?

Gets an instance of the Indexed DB factory to being using Indexed DB.

no setter

innerHeightint?

The height of the viewport including scrollbars.

no setter

innerWidthint?

The width of the viewport including scrollbars.

no setter

isSecureContextbool?

no setter

localStorageStorage

Storage for this window that persists across sessions.

no setter

locationLocation

The current location of this window.

getter/setter pairoverride-getter

locationbarBarProp?

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

no setter

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

no setter

nameString?

The name of this window.

getter/setter pair

navigatorNavigator

The user agent accessing this window.

no setter

offscreenBufferingbool?

Whether objects are drawn offscreen before being displayed.

no setter

onEvents

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

no setterinherited

onAbortStream<Event>

Stream of abort events handled by this Window.

no setteroverride

onAnimationEndStream<AnimationEvent>

Stream of animationend events handled by this Window.

no setter

onAnimationIterationStream<AnimationEvent>

Stream of animationiteration events handled by this Window.

no setter

onAnimationStartStream<AnimationEvent>

Stream of animationstart events handled by this Window.

no setter

onBeforeUnloadStream<Event>

Stream of beforeunload events handled by this Window.

no setter

onBlurStream<Event>

Stream of blur events handled by this Window.

no setteroverride

onCanPlayStream<Event>

no setteroverride

onCanPlayThroughStream<Event>

no setteroverride

onChangeStream<Event>

Stream of change events handled by this Window.

no setteroverride

onClickStream<MouseEvent>

Stream of click events handled by this Window.

no setteroverride

onContentLoadedStream<Event>

Stream of contentloaded events handled by this Window.

no setter

Stream of contextmenu events handled by this Window.

no setteroverride

onDeviceMotionStream<DeviceMotionEvent>

Stream of devicemotion events handled by this Window.

no setter

onDeviceOrientationStream<DeviceOrientationEvent>

Stream of deviceorientation events handled by this Window.

no setter

onDoubleClickStream<Event>

Stream of doubleclick events handled by this Window.

no setteroverride

onDragStream<MouseEvent>

Stream of drag events handled by this Window.

no setteroverride

onDragEndStream<MouseEvent>

Stream of dragend events handled by this Window.

no setteroverride

onDragEnterStream<MouseEvent>

Stream of dragenter events handled by this Window.

no setteroverride

onDragLeaveStream<MouseEvent>

Stream of dragleave events handled by this Window.

no setteroverride

onDragOverStream<MouseEvent>

Stream of dragover events handled by this Window.

no setteroverride

onDragStartStream<MouseEvent>

Stream of dragstart events handled by this Window.

no setteroverride

onDropStream<MouseEvent>

Stream of drop events handled by this Window.

no setteroverride

onDurationChangeStream<Event>

no setteroverride

onEmptiedStream<Event>

no setteroverride

onEndedStream<Event>

no setteroverride

onErrorStream<Event>

Stream of error events handled by this Window.

no setteroverride

onFocusStream<Event>

Stream of focus events handled by this Window.

no setteroverride

onHashChangeStream<Event>

Stream of hashchange events handled by this Window.

no setteroverride

onInputStream<Event>

Stream of input events handled by this Window.

no setteroverride

onInvalidStream<Event>

Stream of invalid events handled by this Window.

no setteroverride

onKeyDownStream<KeyboardEvent>

Stream of keydown events handled by this Window.

no setteroverride

onKeyPressStream<KeyboardEvent>

Stream of keypress events handled by this Window.

no setteroverride

onKeyUpStream<KeyboardEvent>

Stream of keyup events handled by this Window.

no setteroverride

onLoadStream<Event>

Stream of load events handled by this Window.

no setteroverride

onLoadedDataStream<Event>

no setteroverride

onLoadedMetadataStream<Event>

no setteroverride

onLoadStartStream<Event>

no setter

onMessageStream<MessageEvent>

Stream of message events handled by this Window.

no setteroverride

onMouseDownStream<MouseEvent>

Stream of mousedown events handled by this Window.

no setteroverride

onMouseEnterStream<MouseEvent>

Stream of mouseenter events handled by this Window.

no setteroverride

onMouseLeaveStream<MouseEvent>

Stream of mouseleave events handled by this Window.

no setteroverride

onMouseMoveStream<MouseEvent>

Stream of mousemove events handled by this Window.

no setteroverride

onMouseOutStream<MouseEvent>

Stream of mouseout events handled by this Window.

no setteroverride

onMouseOverStream<MouseEvent>

Stream of mouseover events handled by this Window.

no setteroverride

onMouseUpStream<MouseEvent>

Stream of mouseup events handled by this Window.

no setteroverride

onMouseWheelStream<WheelEvent>

Stream of mousewheel events handled by this Window.

no setteroverride

onOfflineStream<Event>

Stream of offline events handled by this Window.

no setteroverride

onOnlineStream<Event>

Stream of online events handled by this Window.

no setteroverride

onPageHideStream<Event>

Stream of pagehide events handled by this Window.

no setter

onPageShowStream<Event>

Stream of pageshow events handled by this Window.

no setter

onPauseStream<Event>

no setteroverride

onPlayStream<Event>

no setteroverride

onPlayingStream<Event>

no setteroverride

onPopStateStream<PopStateEvent>

Stream of popstate events handled by this Window.

no setteroverride

onProgressStream<Event>

no setter

onRateChangeStream<Event>

no setteroverride

onResetStream<Event>

Stream of reset events handled by this Window.

no setteroverride

onResizeStream<Event>

Stream of resize events handled by this Window.

no setteroverride

onScrollStream<Event>

Stream of scroll events handled by this Window.

no setteroverride

onSearchStream<Event>

Stream of search events handled by this Window.

no setter

onSeekedStream<Event>

no setteroverride

onSeekingStream<Event>

no setteroverride

onSelectStream<Event>

Stream of select events handled by this Window.

no setteroverride

onStalledStream<Event>

no setteroverride

onStorageStream<StorageEvent>

Stream of storage events handled by this Window.

no setteroverride

onSubmitStream<Event>

Stream of submit events handled by this Window.

no setteroverride

onSuspendStream<Event>

no setteroverride

onTimeUpdateStream<Event>

no setteroverride

onTouchCancelStream<TouchEvent>

Stream of touchcancel events handled by this Window.

no setteroverride

onTouchEndStream<TouchEvent>

Stream of touchend events handled by this Window.

no setteroverride

onTouchMoveStream<TouchEvent>

Stream of touchmove events handled by this Window.

no setteroverride

onTouchStartStream<TouchEvent>

Stream of touchstart events handled by this Window.

no setteroverride

onTransitionEndStream<TransitionEvent>

Stream of transitionend events handled by this Window.

no setter

onUnloadStream<Event>

Stream of unload events handled by this Window.

no setteroverride

onVolumeChangeStream<Event>

no setteroverride

onWaitingStream<Event>

no setteroverride

onWheelStream<WheelEvent>

Stream of wheel events handled by this Window.

no setteroverride

openerWindowBase?

A reference to the window that opened this one.

getter/setter pairoverride-getter

orientationint?

no setter

originString?

no setter

outerHeightint

The height of this window including all user interface elements.

no setter

outerWidthint

The width of the window including all user interface elements.

no setter

pageXOffsetint

no setter

pageYOffsetint

no setter

parentWindowBase?

A reference to the parent of this window.

no setteroverride

performancePerformance

Timing and navigation data for this window.

no setter

runtimeTypeType

A representation of the runtime type of the object.

no setterinherited

screenScreen?

Information about the screen displaying this window.

no setter

screenLeftint?

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

no setter

screenTopint?

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

no setter

screenXint?

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

no setter

screenYint?

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

no setter

scrollbarsBarProp?

This window's scroll bars.

no setter

scrollXint

The distance this window has been scrolled horizontally.

no setter

scrollYint

The distance this window has been scrolled vertically.

no setter

selfWindowBase?

The current window.

no setter

sessionStorageStorage

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

no setter

speechSynthesisSpeechSynthesis?

Access to speech synthesis in the browser.

no setter

statusString?

Deprecated.

getter/setter pair

statusbarBarProp?

This window's status bar.

no setter

styleMediaStyleMedia?

Access to CSS media queries.

no setter

toolbarBarProp?

This window's tool bar.

no setter

topWindowBase?

A reference to the topmost window in the window hierarchy.

no setteroverride

visualViewportVisualViewport?

no setter

windowWindowBase?

The current window.

no setter

Methods

addEventListener(String type, EventListener? listener, [bool? useCapture])→ void

inherited

alert([String? message])→ void

Displays a modal alert to the user.

atob(String atob)→ String

override

btoa(String btoa)→ String

override

cancelAnimationFrame(int id)→ void

Cancels an animation frame request.

cancelIdleCallback(int handle)→ void

close()→ void

Closes the window.

override

confirm([String? message])→ bool

Displays a modal OK/Cancel prompt to the user.

dispatchEvent(Event event)→ bool

inherited

fetch(dynamic input, [Map? init])→ Future

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

Finds text in this window.

getComputedStyleMap(Element element, String? pseudoElement)→ StylePropertyMapReadonly

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(int x, int y)→ void

Moves this window.

moveTo(Point<num> p)→ void

Moves this window to a specific position.

noSuchMethod(Invocation invocation)→ dynamic

Invoked when a nonexistent method or property is accessed.

inherited

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

Opens a new window.

postMessage(dynamic message, String targetOrigin, [List<Object>? transfer])→ void

Sends a cross-origin message.

override

print()→ void

Opens the print dialog for this window.

removeEventListener(String type, EventListener? listener, [bool? useCapture])→ void

inherited

requestAnimationFrame(FrameRequestCallback callback)→ 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 size bytes.

requestIdleCallback(IdleRequestCallback callback, [Map? options])→ int

resizeBy(int x, int y)→ void

Resizes this window by an offset.

resizeTo(int x, int y)→ void

Resizes this window to a specific width and height.

resolveLocalFileSystemUrl(String url)→ Future<Entry>

Asynchronously retrieves a local filesystem entry.

scroll([dynamic options_OR_x, dynamic y, Map? scrollOptions])→ void

Scrolls the page horizontally and vertically to a specific point.

scrollBy([dynamic options_OR_x, dynamic y, Map? scrollOptions])→ void

Scrolls the page horizontally and vertically by an offset.

scrollTo([dynamic options_OR_x, dynamic y, Map? scrollOptions])→ void

Scrolls the page horizontally and vertically to a specific point.

stop()→ void

Stops the window from loading.

toString()→ String

A string representation of this object.

inherited

Operators

operator ==(Object other)→ bool

The equality operator.

inherited

Static Properties

supportsPointConversionsbool

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

no setter

Constants

animationEndEvent → const EventStreamProvider<AnimationEvent>

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

animationIterationEvent → const EventStreamProvider<AnimationEvent>

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

animationStartEvent → const EventStreamProvider<AnimationEvent>

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

beforeUnloadEvent → const EventStreamProvider<BeforeUnloadEvent>

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

contentLoadedEvent → const EventStreamProvider<Event>

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

deviceMotionEvent → const EventStreamProvider<DeviceMotionEvent>

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

deviceOrientationEvent → const EventStreamProvider<DeviceOrientationEvent>

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

hashChangeEvent → const EventStreamProvider<Event>

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

loadStartEvent → const EventStreamProvider<Event>

messageEvent → const EventStreamProvider<MessageEvent>

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

offlineEvent → const EventStreamProvider<Event>

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

onlineEvent → const EventStreamProvider<Event>

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

pageHideEvent → const EventStreamProvider<Event>

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

pageShowEvent → const EventStreamProvider<Event>

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

PERSISTENT → const int

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

popStateEvent → const EventStreamProvider<PopStateEvent>

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

progressEvent → const EventStreamProvider<Event>

storageEvent → const EventStreamProvider<StorageEvent>

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

TEMPORARY → const int

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

unloadEvent → const EventStreamProvider<Event>

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