Home Reference Source
import Dialog from '@osjs/dialogs/src/dialog.js'
public class | source

Dialog

OS.js default Dialog implementation

Creates a Window with predefined content and actions(s)

Constructor Summary

Public Constructor
public

constructor(core: Core, args: Object, options: Object, callback: Function)

Constructor

Method Summary

Public Methods
public

Gets the button (virtual) DOM elements

public

createView(children: Object[], state: Object): Object

Creates the default view

public

Destroys the dialog

public

emitCallback(name: String, ev: Event, close: Boolean)

Emits the callback

public

Gets the first negative button

public

Gets the first positive button

public

getValue(): *

Gets the dialog result value

public
public

render(cb: Function): *

Renders the dialog

Public Constructors

public constructor(core: Core, args: Object, options: Object, callback: Function) source

Constructor

Params:

NameTypeAttributeDescription
core Core

OS.js Core reference

args Object

Arguments given from service creation

options Object

Dialog options (including Window)

options.defaultValue Object
  • optional

Default callback value

callback Function

The callback function

Public Methods

public createButtons(states: Object): Object[] source

Gets the button (virtual) DOM elements

Params:

NameTypeAttributeDescription
states Object
  • optional

Button states

Return:

Object[]

Virtual dom node children list

public createView(children: Object[], state: Object): Object source

Creates the default view

Params:

NameTypeAttributeDescription
children Object[]

Child nodes

state Object
  • optional

Pass on application state (mainly used for buttons)

Return:

Object

Virtual dom node

public destroy() source

Destroys the dialog

public emitCallback(name: String, ev: Event, close: Boolean) source

Emits the callback

Params:

NameTypeAttributeDescription
name String

Button or action name

ev Event
  • optional

Browser event reference

close Boolean
  • optional
  • default: false

Close dialog

public getNegativeButton(): String | undefined source

Gets the first negative button

Return:

String | undefined

public getPositiveButton(): String | undefined source

Gets the first positive button

Return:

String | undefined

public getValue(): * source

Gets the dialog result value

Return:

*

public playSound(): boolean source

Return:

boolean

public render(cb: Function): * source

Renders the dialog

Params:

NameTypeAttributeDescription
cb Function

Callback from window

Return:

*