The Dialog Factory Interface
The dialog factory interface creates BrowserWindow
instances meant to be used as dialogs in Jancy.
There is only one dialog factory and it can always be found at jancy.dialogFactory
.
Methods
dialogFactory.create(parent, browserWindowOptions, options)
parent
(BrowserWindow|string
) the BrowserWindow that will be the parent of this dialog. When a string use ‘focused’ to get the currently focused tabbrowserWindowOptions
(object
) options to override the defaults used by the factoryoptions
(object
) dialog factory specific optionscenterRelativeToParent
(boolean
) optional iftrue
the resulting dialog will be centerered relative toparent
Returns a BrowserWindow
instance.
This example will open a dialog for the current tab and it will load google.com.
let dialog = jancy.dialogFactory.create( 'focused', { width: 400, height: 175, title: 'My Dialog' }, { centerRelativeToParent: true } ) //example of loading a url in a dialog dialog.once('ready-to-show', , () => { dialog.webContents.loadURL("https://google.com") dialog.show() //needed to show the dialog })
This example is to show how to use the error dialog in the dialog factory.
this.jancy.dialogFactory.errorDialog( ‘This is the title of the Dialog’, ‘This is the body of the Dialog.’ )