This module will open and manage Electron BrowserWindow instances, and make sure that they all close when the app closes.
- fbwindow
- open ⏏
- new open(urlToOpen, [setOptions])
- instance
- .window()
- .waitForShow() ⇒
Promise.<void>
- .waitForClose() ⇒
Promise.<void>
- .resize() ⇒
object
- .send(channel, payload)
- .receive(channel, [callback]) ⇒
Promise.<(string|number|object|array)>
- .close()
- inner
- ~openModal(urlToOpen, parentWindow, setOptions) ⇒
Promise.<WindowObject>
- ~openModal(urlToOpen, parentWindow, setOptions) ⇒
- open ⏏
Opens a BrowserWindow.
Kind: Exported class
See: BrowserWindow options
Create a window.open object. The window will automatically track window changes in size and position and keep the bounds changes in localStorage.
Returns: Promise.<WindowObject>
- An WindowObject inhereted from BrowserWindow
Param | Type | Description |
---|---|---|
urlToOpen | string |
Opens the window and loads this page |
[setOptions] | options |
A set of options for changing the window properties |
Why is this function here? If you create a new window.open object and pass that to dialog.showMessageBox() for a modal doalog, it won't render the dialog content (i.e. it's a blank dialog). Even when you capture the constructor super(), the call to showMessageBox() still comes up blank. This method returns an actual BrowserWindow object that is satisfactory for building a modal dialog.
Kind: instance method of open
If you open the window with option show:false then call window.show(), use this function to get a Promise that returns after the window is visible.
Kind: instance method of open
If you close the window with window.close(), use this function to get a Promise that returns after the window is destroyed.
Kind: instance method of open
Recalls the last saved position and shape of the window, particularly useful for the first showing of the window.
Kind: instance method of open
Returns: object
- Returns the previous bounds object that the window will now be set to
Sends a message - a payload on a specific channel - to the BrowserWindow
Kind: instance method of open
See: BrowserWindow.webContents.send()
Param | Type | Description |
---|---|---|
channel | string |
A topic which the BrowserWindow should be expecting |
payload | string | number | object | array |
The message content to send on the topic |
Receives a message event from the BrowserWindow, with optional callback or Promise interface. The callback or Promise will fire whenever a message event is received on the channel.
Kind: instance method of open
Returns: Promise.<(string|number|object|array)>
- If no callback is supplied then a Promise is returned
See: BrowserWindow.webContents.send()
Param | Type | Description |
---|---|---|
channel | string |
A topic which the BrowserWindow should be expecting |
[callback] | function |
Optional callback function to receive the message event |
Close the window.
Kind: instance method of open
Similar to window.open() except a modal window is created as a child to the parentWindow.
Kind: inner method of open
Returns: Promise.<WindowObject>
- An WindowObject inhereted from BrowserWindow
See: BrowserWindow options
Param | Type | Description |
---|---|---|
urlToOpen | string |
Opens the window and loads this page |
parentWindow | BrowserWindow |
A BrowserWindow which will contain the model window |
setOptions | options |
A set of options for changing the window properties |