Constructor
new module:caplin/popout/Popout(relativeUrl, windowParameters)
Creates a popout window. The opened window may contain any content, with the caveat that it references
module:caplin/popout/PopoutService
. Typically this content will be a representation of a component "popped
out" of the main application's window.
A Popout
may have properties set on it, and events fired on it, both of which will be reflected on the
module:caplin/popout/PopoutService
in the popout window, allowing communication between the opening window
and the popout window.
This class uses emitr, and fires the following events:
- caplin.popout.Popout.EVENTS.POPOUT_READY
- Fired after #_onPopoutWindowReady has completed.
- caplin.popout.Popout.EVENTS.POPOUT_BLOCKED
- Fired if the browser blocks the popout window from opening.
- caplin.popout.Popout.EVENTS.POPOUT_TIMEOUT
- Fired if the popped out window takes longer than a given time to open. This is 10000ms by default, and can be set using the 'CAPLIN.POPOUT.TIMEOUT.LOAD' property on caplin.config-service.
- caplin.popout.Popout.EVENTS.POPOUT_CLOSED
- Fired when the popped out window is closed.
- caplin.popout.Popout.EVENTS.PROPERTIES_CHANGED
- Fired when the properties of this Popout are changed. Event args: {map} properties A map of the new values of the changed properties.
- caplin.popout.Popout.EVENTS.POPOUT_RESIZED
- Fired when the popped out window is resized. Event args: {int} width The new width of the popped out window, {int} height The new height of the popped out window.
Parameters:
Name | Type | Description |
---|---|---|
relativeUrl |
string | The relative URL that the popped out window will use. |
windowParameters |
object | Parameters to be passed to the window.open call. |
Methods
-
close()
-
Closes the popout window.
-
fireEvent(name, properties)
-
Fires the given event both on this object and on the
caplin.popout.PopoutService
in the popout window.Parameters:
Name Type Description name
string The name of the event. properties
Object A map of properties to be passed along with the event. -
getProperties() → {map}
-
Gets the properties for this
Popout
.Returns:
properties The map of properties for this popout.- Type
- map
-
getProperty(propertyName) → {var}
-
Gets the value for a given property.
Parameters:
Name Type Description propertyName
String The name of the property to get. Returns:
The value of the property.- Type
- var
-
getWindow() → {object}
-
Gets the popout window.
Returns:
the window object for the popped out window.- Type
- object
-
getWindowGeometrics() → {map}
-
Returns the current position and dimensions of the popout window.
Returns:
Contains geometric properties with integer values. Included properties are: 'width', 'height', 'left' and 'top'.- Type
- map
-
open(width, height)
-
Opens the popout window with the given width and height.
Parameters:
Name Type Description width
int The desired width for the opened window. height
int The desired height for the opened window. -
setProperties(properties)
-
Sets properties for this
Popout
that can be accessed in the popped out window using thePopoutService
'sgetProperty
andgetProperties
methods.Parameters:
Name Type Description properties
Object The map of properties to set.