Skip to content

Latest commit

 

History

History
121 lines (89 loc) · 5.84 KB

windows.js.md

File metadata and controls

121 lines (89 loc) · 5.84 KB

fbwindow

This module will open and manage Electron BrowserWindow instances, and make sure that they all close when the app closes.

open ⏏

Opens a BrowserWindow.

Kind: Exported class
See: BrowserWindow options

new open(urlToOpen, [setOptions])

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

open.window()

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

open.waitForShow() ⇒ Promise.<void>

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

open.waitForClose() ⇒ Promise.<void>

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

open.resize() ⇒ object

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

open.send(channel, payload)

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

open.receive(channel, [callback]) ⇒ Promise.<(string|number|object|array)>

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

open.close()

Close the window.

Kind: instance method of open

open~openModal(urlToOpen, parentWindow, setOptions) ⇒ Promise.<WindowObject>

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