class dom::Win

sys::Obj
  dom::Win

@Js

Source

Win models the DOM window object.

See pod doc for details.

addStyleRules

Void addStyleRules(Str rules)

Source

Add new CSS style rules to this page.

alert

Void alert(Obj obj)

Source

Display a modal message box with the given text.

clearInterval

Void clearInterval(Int intervalId)

Source

Cancels a repeated action which was set up using setInterval.

clearTimeout

Void clearTimeout(Int timeoutId)

Source

Clears the delay set by setTimeout.

close

Win close()

Source

Close this window. Only applicable to windows created with open. Otherwise method has no effect. Returns this.

cur

const static Win cur()

Source

Return the current window instance.

doc

Doc doc()

Source

Return the Doc instance for this window.

hisBack

Void hisBack()

Source

Go to previous page in session history.

hisForward

Void hisForward()

Source

Go to next page in the session history.

hisPushState

Void hisPushState(Str title, Uri uri, Str:Obj map)

Source

Push a new history item onto the history stack. Use onpopstate to listen for changes:

// Event.stash contains state map passed into pushState
Win.cur.onEvent("popstate", false) |e| { echo("# state: $e.stash") }
hisReplaceState

Void hisReplaceState(Str title, Uri uri, Str:Obj map)

Source

Modify the current history item.

Void hyperlink(Uri uri)

Source

Hyperlink to the given Uri in this window.

localStorage

Storage localStorage()

Source

Return local storage instance for window.

onEvent

Func onEvent(Str type, Bool useCapture, |Event| handler)

Source

Attach an event handler for the given event on this window. Returns callback function instance.

open

const static Win open(Uri uri := `about:blank`, Str? winName := null, [Str:Str]? opts := null)

Source

Open a new window. Returns the new window instance.

parent

Win? parent()

Source

Returns a reference to the parent of the current window or subframe, or null if this is the top-most window.

reload

Void reload(Bool force := false)

Source

Reload the current page. Use force to bypass browse cache.

removeEvent

Void removeEvent(Str type, Bool useCapture, Func handler)

Source

Remove the given event handler from this window. If this handler was not registered, this method does nothing.

reqAnimationFrame

Void reqAnimationFrame(|This| f)

Source

Request the browser to perform an animation before the next repaint.

screenSize

Size screenSize()

Source

Return the size of the screen in pixels.

sessionStorage

Storage sessionStorage()

Source

Return session storage instance for window.

setInterval

Int setInterval(Duration delay, |This| f)

Source

Calls a function repeatedly, with a fixed time delay between each call to that function. Returns an intervalId that can be used in clearInterval.

setTimeout

Int setTimeout(Duration delay, |This| f)

Source

Call the specified function after a specified delay. Returns a timeoutId that can be used in clearTimeout.

top

Win top()

Source

Returns a reference to the topmost window in the window hierarchy. If this window is the topmost window, returns self.

uri

Uri uri()

Source

Get the Uri for this window.

viewport

Size viewport()

Source

Return the size of the window viewport in pixels.