High-level functions for quickly building the main application.
- mainapp
- event ⏏
- setupAppConfig() ⏏
- sendToBrowser(channel, payload) ⏏
- getFromBrowser(channel, [callback]) ⇒
Promise.<(string|number|object|array)>
⏏ - closeApplication() ⏏
- signoutUser() ⏏
- onUserLogin(user) ⇒
Promise.<object>
⏏ - registerAPI(method, urlInvocation, apiRouteFunction) ⏏
- startMainApp(options) ⏏
Exports a node.js Event Emitter object that can be used to send and receive messages with other parts of the application.
Kind: Exported member
See: Events
Must be called before other APIs. Reads the two configuration files, app-config.json and firebase-config.json, and creates a global.appContext object with various information.
Sends a message - a payload on a specific channel - to the global.mainWindow.
Kind: Exported function
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 global.mainWindow, with optional callback or Promise interface. The callback or Promise will fire whenever a message event is received on the channel.
Kind: Exported function
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 |
Call this before the app closes to perform some app cleanup.
Handles the workflow for signing out the current user. The user will be presented with a dialog box asking them to confirm signout, and optionally to sign out of the current identity provider as well as the app. Fires the user-signout event when complete.
This function is called after a user login has completed, which can happen after a new login workflow, or after a re-login from a previous session. Fires the user-login event when complete.
Kind: Exported function
Returns: Promise.<object>
- Resolves after the CloudStore updates are completed
Param | Type | Description |
---|---|---|
user | object |
The user object that was returned from the login workflow |
Registers a function that will respond to an API request from the Browser. This will set up a route with the express middleware in the Main node.js process. For Browser pages, the /scripts/webutils.js file contains an api() function that can be used to invoke a route registered with registerAPI().
Kind: Exported function
See: Routing in Express
Param | Type | Description |
---|---|---|
method | string |
the HTTPS method such as 'GET', 'POST', etc. |
urlInvocation | string |
the localhost URL to invoke, e.g. "/api/loginready" |
apiRouteFunction | function |
API request called in express style i.e. (req,res,next) |
This is it, the function that kicks it all off.
Kind: Exported function
Param | Type | Description |
---|---|---|
options | object |
May contain show, width, height, title, main_html |