Methods
_doLog(message, type, data, forceToWindow){undefined}
Parameters
Name |
Type |
Description |
message |
string
|
Message to be logged |
type |
string
|
Type of log message (debug, info, warning, error, group, groupCollaped, groupend) |
data |
array
|
An array of data strings that are to be applied to logging message |
forceToWindow |
Boolean
|
Flag to force logging to main window console |
Logs data to console
_getStack(){array}
Helper method for getting call stack array for debug or user message objects
addBoundMethods(){undefined}
Method that sets up this.boundMethods property by binding this objects
functions to itself to be used as event listener handlers
addEventListeners(){undefined}
Adds event listeners
addGlobalEmitterEventListeners(){undefined}
Adds global emitter event listeners
addMainWindowEventListeners(){undefined}
Adds main window event listeners
clearIntervals(){undefined}
Clears all intervals bound to this AppWrapper instance
clearTimeouts(){undefined}
Clears all timeouts bound to this AppWrapper instance
consoleLog(message){undefined}
Parameters
Name |
Type |
Description |
message |
mixed
|
Message to log |
Logs message to console
createDirFileRecursive(fileName, mode, options, data){Boolean}
Parameters
Name |
Type |
Description |
fileName |
string
|
Absolute path to file |
mode |
Number
|
Octal mode definition (i.e. 0o775) |
options |
Object
|
Options object for fs.writeFileSync |
data |
string
|
Data to write to file |
Creates directory (recursive) and writes file to it
createDirRecursive(directory, mode){Boolean}
Parameters
Name |
Type |
Description |
directory |
string
|
Absolute directory path |
mode |
Number
|
Octal mode definition (i.e. 0o775) |
Creates directory recursively
destroy(){undefined}
Destroys current MainScript class instance
finalize(){Boolean}
Finalizes current class instance, setting up any additional properties
etc. Entire app structure, including frontend app is available here
finalizeDebugMessageLog(){boolean}
Finalizes debug log file if debug logging to file is enabled
formatTimeNormalize(date, options, includeDate, omitSeconds){string}
Parameters
Name |
Type |
Description |
date |
Date
|
Date value to format |
options |
Object
|
Date format options |
includeDate |
Boolean
|
Flag to indicate whether to include date |
omitSeconds |
Boolean
|
Flag to indicate whether to omit seconds |
Format time normalized (Y-m-d H:i:s format)
getAppState(){appWrapper.AppState}
Gets appState if available
getAppWrapper(){AppWrapper}
Gets appWrapper if available
getConfig(name, defaultValue){mixed}
Parameters
Name |
Type |
Description |
name |
string
|
String representing path to requested var (i.e. 'appConfig.appInfo.name') |
defaultValue |
mixed
|
Default value to be returned if configuration var is not found |
Returns configuration var value
getDebugMessageFilePath(){string}
Returns path to debug message log file
getExecPath(){string}
Returns base exec path (root dir of the app)
getHelper(name){Object}
Parameters
Name |
Type |
Description |
name |
string
|
Name of the helper |
Returns instance of helper object based on passed parameter (or false if helper can't be found)
getInitialAppConfig(defaultAppConfig){Object}
Parameters
Name |
Type |
Description |
defaultAppConfig |
Object
|
Default application config |
Loads config overrides if present, and returns config object for the app
Returns main script object
getMainWindow(){Window|Boolean}
Gets reference to main window if available
getPlatformData(){Object}
Returns platform data for current platform
getStateVar(varPath, defaultValue){mixed}
Parameters
Name |
Type |
Description |
varPath |
string
|
String representing path to requested var (i.e. 'appData.appMainData.cancelable') |
defaultValue |
mixed
|
Default value to be returned if appState var is not found |
Returns appState var value
initialize(options){MainScript}
Parameters
Name |
Type |
Description |
options |
Object
|
Object with 'manifest' property containing manifest file data and 'config' property containing config data |
Initializes MainScript using manifest and app config data
initializeDebugMessageLog(){boolean}
Initializes debug message log file if debug message logging to file is enabled
initializeGlobalEmitter(){undefined}
Initializes globalEmitter object for communication with the app
initializeLogging(){BaseClass}
Determines whether logging for this class is regulated through
configuration, setting the logging by it (or warning if there
are no configuration settings for this class)
isFile(file){Boolean}
Parameters
Name |
Type |
Description |
file |
string
|
Absolute file path |
Checks whether given path is a file
isLinux(){Boolean}
Checks whether current platform is linux
isMac(){Boolean}
Checks whether current platform is mac
isWindows(){Boolean}
Checks whether current platform is windows
log(message, type, data, force, forceToWindow){undefined}
Parameters
Name |
Type |
Description |
message |
string
|
Message to be logged |
type |
string
|
Type of log message (debug, info, warning, error, group, groupCollaped, groupend) |
data |
array
|
An array of data strings that are to be applied to logging message |
force |
Boolean
|
Flag to force logging output even if config does not allow it |
forceToWindow |
Boolean
|
Flag to force logging to main window console |
Logs message to console or stdout
onMessage(data){mixed}
Parameters
Name |
Type |
Description |
data |
Object
|
Data passed with message |
Handles messages received from the app
print(message){undefined}
Parameters
Name |
Type |
Description |
message |
string
|
Message to print |
Prints message to stdout
printLn(message){undefined}
Parameters
Name |
Type |
Description |
message |
string
|
Message to print |
Prints message to stdout with newline appended
printLog(message, type){undefined}
Parameters
Name |
Type |
Description |
message |
string
|
Message to print |
type |
string
|
Type of message |
Prints message to stdout with newline appended
removeBoundMethods(){undefined}
Method that cleans up this.boundMethods property
set in this.addBoundMethods method
removeEventListeners(){undefined}
Removes event listeners
removeGlobalEmitterEventListeners(){undefined}
Removes global emitter window event listeners
removeMainWindowEventListeners(){undefined}
Removes main window event listeners
setNewConfig(configData){undefined}
Parameters
Name |
Type |
Description |
configData |
Object
|
Object with config data |
Sets new config to data from argument
sigInt(code){undefined}
Parameters
Name |
Type |
Description |
code |
Integer
|
Optional exit code for the app |
Handler for SIGINT signal
sigTerm(code){undefined}
Parameters
Name |
Type |
Description |
code |
Integer
|
Optional exit code for the app |
Handler for SIGTERM signal
start(){undefined}
Starts the application
uncaughtException(err){undefined}
Parameters
Name |
Type |
Description |
err |
Error
|
Uncaught exception |
Handler for uncaught exceptions
windowClose(e){undefined}
Parameters
Name |
Type |
Description |
e |
Event
|
Event that triggered the method |
Handler for mainWindow 'close' event
windowClosed(e, noExit){undefined}
Parameters
Name |
Type |
Description |
e |
Event
|
Event that triggered the method |
noExit |
Boolean
|
Flag to prevent exiting main process |
Handler for mainWindow 'closed' event
windowLoaded(){undefined}
Handler for main window 'loaded' event
windowLog(){undefined}
Logs to window console