Window

Window

A Window class.

Constructor

new Window(config)

Wraps a window object.

Parameters:
Name Type Description
config Object

Configuration

Extends

Methods

(static) getAll() → {Array.<Window>}

Returns a list of all Window instances open.

Returns:
Type
Array.<Window>

(static) getByID(id) → {Window|undefined}

Returns the Window instance that has id.

Parameters:
Name Type Description
id String | Number
Returns:
Type
Window | undefined

(static) getCurrent() → {Window}

Returns the Window instance that calls this function.

Returns:
Type
Window

addPipe(eventHandler)

Parameters:
Name Type Description
eventHandler EventHandler
Inherited From:

bringToFront(callbackopt)

Brings the window instance to the front of all windows.

Parameters:
Name Type Attributes Description
callback Callback <optional>

clearEvent(eventNames)

Parameters:
Name Type Description
eventNames String
Inherited From:

close(callbackopt)

Closes the window instance.

Parameters:
Name Type Attributes Description
callback Callback <optional>

dock(other)

Force docking this window to another. They don't need to be touching.

Parameters:
Name Type Attributes Description
other Window
Callback <optional>

emit(eventName, …args) → {Boolean}

Parameters:
Name Type Attributes Description
eventName String
args * <repeatable>

Arguments to pass to listeners

Inherited From:
Returns:

true if all handlers return true, else false

Type
Boolean

focus(callbackopt)

Sets focus to the window instance.

Parameters:
Name Type Attributes Description
callback Callback <optional>

getBounds() → {BoundingBox}

Returns window's bounding box.

Returns:
Type
BoundingBox

getHeight() → {Number}

Returns window's height.

Returns:
Type
Number

getPosition() → {Vector}

Returns window's current position.

Returns:
Type
Vector

getSize() → {Size}

Returns window's size.

Returns:
Type
Size

getTitle() → {String}

Returns window's title.

Returns:
Type
String

getWidth() → {Number}

Returns window's width.

Returns:
Type
Number

hide(callbackopt)

Hides the window instance.

Parameters:
Name Type Attributes Description
callback Callback <optional>

isClosed() → {Boolean}

Returns whether window has been closed already.

Returns:
Type
Boolean

isHidden() → {Boolean}

Returns true if window is hidden.

Returns:
Type
Boolean

isMaximized() → {Boolean}

Returns true if window is maximized.

Returns:
Type
Boolean

isMinimized() → {Boolean}

Returns true if window is minimized.

Returns:
Type
Boolean

isReady() → {Boolean}

Returns true if the Window instance is created, not closed, and ready for method calls.

Returns:
Type
Boolean

isRestored() → {Boolean}

Returns true if window is not hidden or minimize or maximized.

Returns:
Type
Boolean

isShown() → {Boolean}

Returns true if window is not hidden.

Returns:
Type
Boolean

maximize(callbackopt)

Maximizes the window instance.

Parameters:
Name Type Attributes Description
callback Callback <optional>

minimize(callbackopt)

Minimizes the window instance.

Parameters:
Name Type Attributes Description
callback Callback <optional>

moveBy(deltaLeft, deltaTop, callbackopt)

Moves the window instance relative to its current position.

Parameters:
Name Type Attributes Description
deltaLeft Number
deltaTop Number
callback Callback <optional>

moveTo(left, top, callbackopt)

Moves the window instance.

Parameters:
Name Type Attributes Description
left Number
top Number
callback Callback <optional>

off(eventNames, eventListener)

Parameters:
Name Type Description
eventNames String
eventListener callback
Inherited From:

on(eventNames, eventListener)

Parameters:
Name Type Description
eventNames String
eventListener callback
Inherited From:

once(eventName, eventListener)

Parameters:
Name Type Description
eventName String
eventListener callback
Inherited From:

onReady(callbackopt)

Calls a callback when window is ready and setup.

Parameters:
Name Type Attributes Description
callback Callback <optional>

removePipe(eventHandler)

Parameters:
Name Type Description
eventHandler EventHandler
Inherited From:

resizeTo(width, height, callbackopt)

Resizes the window instance.

Parameters:
Name Type Attributes Description
width Number
height Number
callback Callback <optional>

restore(callbackopt)

Restores the window instance from the minimized or maximized states.

Parameters:
Name Type Attributes Description
callback Callback <optional>

setBounds(left, top, right, bottom, callbackopt)

Sets the bounds of the window instance.

Parameters:
Name Type Attributes Description
left Number
top Number
right Number
bottom Number
callback Callback <optional>

setTitle(title)

Sets window's title.

Parameters:
Name Type Description
title String

show(callbackopt)

Unhides the window instance.

Parameters:
Name Type Attributes Description
callback Callback <optional>

undock(other)

Force undocking this window from it's group.
TODO: Redock those still touching, EXCEPT 'this'.

Parameters:
Name Type Attributes Description
other Window
Callback <optional>