new module:ct-popout /Window Service()
Provides utility functions that assist in writing multi-window applications. This service can be accessed from the
module:ct-core/ServiceRegistry
using the alias "caplin.window-service".
Methods
export ToMain Window(object ToImport) → {Object}
Returns a copy of an object that is safe to use in the application's main window. The given object must originate from the current window, and must be convertible to a JSON string.
Parameters:
Name | Type | Description |
---|---|---|
objectToImport |
Object | An object from the current window. |
Returns:
A copy of the object that is safe to use in the application's main window.
- Type
- Object
import From Main Window(object ToImport) → {Object}
Returns a copy of an object that is safe to use in the current window. The given object must originate from the application's main window, and must be convertible to a JSON string.
Parameters:
Name | Type | Description |
---|---|---|
objectToImport |
Object | An object from the application's main window. |
Returns:
A copy of the object that is safe to use in the current window.
- Type
- Object
is Popout() → {boolean}
Used to determine if the current window is a popout.
Returns:
true
if the window is a popout, otherwise false
.
- Type
- boolean
on Popout Window Ready(popout Window, popout Service)
Called by PopoutService when the popout window has loaded. Calls the onReady and adds event listeners to the main window and popout windows to call the onClose and onPopoutClosed functions provided to WindowService.open().
Parameters:
Name | Type | Description |
---|---|---|
popoutWindow |
window | reference to the popout window object. |
popoutService |
module:ct-popout |
reference to the PopoutService inside the popout window. |
open(relative Url, window Name, window Properties, callbacks)
A wrapper for window.open that also accepts various callbacks.
Parameters:
Name | Type | Description |
---|---|---|
relativeUrl |
String | relative URL of page to be opened, to be passed to window.open. |
windowName |
String | name of window to be passed to window.open. |
windowProperties |
String | comma-separated list of property assignments to be passed to window.open. |
callbacks |
Object |
A simple map of callbacks, of the form:
|