Class: Window

Window

Window class returned by WindowManager.createWindow()

new Window (wm, options)

Name Type Description
wm WindowManager optional
options object optional
Fires:
  • event:open
  • event:focus
  • event:blur
  • event:close
  • event:maximize
  • event:maximize-restore
  • event:move
  • event:move-start
  • event:move-end
  • event:resize
  • event:resize-start
  • event:resize-end
  • event:move-x
  • event:move-y
  • event:resize-width
  • event:resize-height

Extends

Classes

Window

Members

bottom number

bottom coordinate of window

closed boolean readonly

is window closed?

content HTMLElement readonly

This is the content DOM element. Use this to add content to the Window.

height number

height of window
right coordinate of window

title string

change title

width number

width of window

win HTMLElement readonly

This is the top-level DOM element

x number

left coordinate

y number

top coordinate

Methods

attachToScreen (direction, location)

attaches window to a side of the screen
Name Type Description
direction 'horizontal' | 'vertical'
location 'left' | 'right' | 'top' | 'bottom'

blur ()

blur the window

center (win)

centers window in middle of other window or document.body
Name Type Description
win Window optional

close ()

closes the window (can be reopened with open)

emit (event)Boolean inherited overrides

Calls each of the listeners registered for a given event.
Name Type Description
event String | Symbol The event name.
Returns:
Type Description
Boolean `true` if the event had listeners, else `false`.

eventNames ()Array inherited overrides

Return an array listing the events for which the emitter has registered listeners.
Returns:
Type Description
Array

focus ()

focus the window

isClosed ()boolean

Returns:
Type Description
boolean

isModal (ignoreClosed)boolean

Name Type Description
ignoreClosed boolean optional
Returns:
Type Description
boolean

listenerCount (event)Number inherited overrides

Return the number of listeners listening to a given event.
Name Type Description
event String | Symbol The event name.
Returns:
Type Description
Number The number of listeners.

listeners (event)Array inherited overrides

Return the listeners registered for a given event.
Name Type Description
event String | Symbol The event name.
Returns:
Type Description
Array The registered listeners.

load (data)

return the state of the window
Name Type Description
data object from save()

maximize ()

maximize the window

move (x, y)

move window
Name Type Description
x number
y number

once (event, fn, context)EventEmitter inherited overrides

Add a one-time listener for a given event.
Name Type Default Description
event String | Symbol The event name.
fn function The listener function.
context * this optional The context to invoke the listener with.
Returns:
Type Description
EventEmitter `this`.

on (event, fn, context)EventEmitter inherited overrides

Add a listener for a given event.
Name Type Default Description
event String | Symbol The event name.
fn function The listener function.
context * this optional The context to invoke the listener with.
Returns:
Type Description
EventEmitter `this`.

open (noFocus)

open the window
Name Type Description
noFocus boolean optional do not focus window when opened

removeAllListeners (event)EventEmitter inherited overrides

Remove all listeners, or those of the specified event.
Name Type Description
event String | Symbol optional The event name.
Returns:
Type Description
EventEmitter `this`.

removeListener (event, fn, context, once)EventEmitter inherited overrides

Remove the listeners of a given event.
Name Type Description
event String | Symbol The event name.
fn function Only remove the listeners that match this function.
context * Only remove the listeners that have this context.
once Boolean Only remove one-time listeners.
Returns:
Type Description
EventEmitter `this`.

resize (width, height)

resize the window
Name Type Description
width number
height number

resizePlacement (bounds, keepInside)

Name Type Description
bounds Bounds
keepInside boolean | 'horizontal' | 'vertical'

save ()object

save the state of the window
Returns:
Type Description
object data

sendToBack ()

sends window to back of window-manager

sendToFront ()

send window to front of window-manager

Events

Fires when window loses focus
Type:
Fires when window closes
Type:
Fires when window gains focus
Type:

maximize

Fires when window is maximized
Type:

maximize-restore

Fires when window is restored to normal after being maximized
Type:
Fires during move
Type:

move-end

Fires after move completes
Type:

move-start

Fires when move starts
Type:

move-x

Fires when x position of window is changed
Type:

move-y

Fires when y position of window is changed
Type:
Fires when window opens
Type:

resize

Fires during resizing
Type:

resize-end

Fires after resize completes
Type:

resize-height

Fires when height is changed
Type:

resize-start

Fires when resize starts
Type:

resize-width

Fires when width is changed
Type: