Skip to content

Dialog

Defined in: window/dialog.ts:54

This class is used to spawn new browser processes that can be used to open other URLs. Source plugins do not have this functionality (but their properties windows may use this.)

Note that opening a new dialog replaces the old one. Also, dialogs are considered to be the same type of window as their parent windows: e.g., dialogs from extension windows are considered by the framework to have access to the same functions as extensions.

Most of the methods are chainable.

Sample usage:

var xjs = require('xjs');
var Dialog = xjs.Dialog;
xjs.ready().then(function() {
var button = document.getElementById('openDialogButton');
button.addEventListener('click', function() {
xjs.Dialog.createDialog('your.url/here.html')
.setSize(500, 800)
.setTitle('ThisDialogReturnsAString')
.setBorderOptions(true, false)
.setButtons(true, true)
.setCookiePath('cookiePath')
.show(function(dialog) {
dialog.getResult().then(function(result) {
document.getElementById('input').value = result;
});
})
});
});
// in the opened dialog, call Dialog.return() to return a value
//
// see documentation below for more details

new Dialog(): Dialog

Defined in: window/dialog.ts:68

Dialog

close(): Promise<any>

Defined in: window/dialog.ts:378

Closes the dialog that this window spawned.

Promise<any>


getResult(): Promise<string>

Defined in: window/dialog.ts:334

return: Promise

Gets the string result returned from the spawned dialog.

Promise<string>


setBorderOptions(showBorder?, resizable?): Dialog

Defined in: window/dialog.ts:204

param: (showBorder: boolean, resizable: boolean)

return: Dialog

Specifies the border and resizable flags for the dialog to be displayed.

Chainable.

boolean = false

boolean = false

Dialog


setButtons(isMinimizeActive?, isMaximizeActive?): Dialog

Defined in: window/dialog.ts:223

param: (isMinimizeActive: boolean, isMaximizeActive: boolean)

return: Dialog

Specifies if the window buttons (minimize and maximize) should be active.

Chainable.

boolean = false

boolean = false

Dialog


setCookiePath(cookiePath): Dialog

Defined in: window/dialog.ts:242

param: (cookiePath: string)

return: Dialog

Sets the cookie Path of the dialog.

Chainable.

string

Dialog


setSize(width?, height?): Dialog

Defined in: window/dialog.ts:172

param: (width: number, height: number)

return: Dialog

Sets the size in pixels of the dialog to be displayed.

Chainable.

number = 300

number = 300

Dialog


setTitle(title): Dialog

Defined in: window/dialog.ts:186

param: (title: string)

return: Dialog

Sets the title of the dialog to be displayed.

Chainable.

string

Dialog


show(): Promise<Dialog>

Defined in: window/dialog.ts:258

return: Promise

After configuring the dialog, call this function to spawn it.

Chainable.

Promise<Dialog>


showWithJS(script): Promise<Dialog>

Defined in: window/dialog.ts:301

param: (script: string)

return: Promise

After configuring the dialog, call this function to spawn it. A javascript string parameter can be passed to have more control over the dialog

Chainable.

string

Promise<Dialog>


static createAutoDialog(url): Dialog

Defined in: window/dialog.ts:126

param: (url: string)

return: Dialog

Creates a Dialog object pointing to a URL, that autocloses on an outside click. AutoDialogs only have access to the setSize and show methods.

Chainable.

string

Dialog


static createDialog(url): Dialog

Defined in: window/dialog.ts:110

param: (url: string)

return: Dialog

Creates a Dialog object pointing to a URL. Call the other methods to modify the dialog’s properties, and show() to spawn the dialog.

Chainable.

string

Dialog


static return(result?): Promise<any>

Defined in: window/dialog.ts:150

param: (result ?: string)

Closes this dialog with an optional string result. For more complex return values, try JSON.stringify. (Call this method from the dialog.)

As an alternative, lightweight dialogs that do not want to include xjs.js may simply call native XBC methods to return a value.

external.SetDialogResult(stringResult);
external.Close();

string

Promise<any>