Methods
_doLog(debugMessage){undefined}
Parameters
Name |
Type |
Description |
debugMessage |
Object
|
Message object to be logged (returned by this.getMessageObject method) |
Does actual logging to console (and log file is file logging is enabled)
_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
addDesktopNotification(message, data, dontTranslate, options, callbacks){undefined}
Parameters
Name |
Type |
Description |
message |
string
|
Notification message |
data |
array
|
An array of data strings that are to be applied to notification |
dontTranslate |
Boolean
|
Flag to prevent automatic notification translation |
options |
Object
|
Desktop notification options (passed to HTML5 Notification object constructor) |
callbacks |
Object
|
Object with onshow, onClicked, onClosed and onerror notification handlers |
Displays desktop notification
Notification message is being interpolated by replacing placeholders
such as '{1}', '{2}' etc. by corresponding values from 'data' argument
addEventListeners(){undefined}
Adds event listeners for this object
addLabel(label){undefined}
Parameters
Name |
Type |
Description |
label |
string
|
Label to add |
Adds label to translation data (for all languages)
addLabels(language, labelData){undefined}
Parameters
Name |
Type |
Description |
language |
Object
|
Language data object with properties code, name and locale |
labelData |
Object
|
Labels to be added in format { labelText: translationText } |
Add all labels from argument to given language
addModalMessage(message, type, data, important, dontTranslate, force, passToDebug){undefined}
Parameters
Name |
Type |
Description |
message |
string
|
Message to be logged |
type |
string
|
Type of log message (debug, info, warning, error) |
data |
array
|
An array of data strings that are to be applied to logging message |
important |
Boolean
|
Flag to indicate message importance |
dontTranslate |
Boolean
|
Flag to prevent automatic message translation |
force |
Boolean
|
Flag to force message output even if configuration wouldn't allow it |
passToDebug |
Boolean
|
Flag to force passing same message to debug log |
Adds modal message to currently open modal dialog
Message is being interpolated by replacing placeholders
such as '{1}', '{2}' etc. by corresponding values from 'data' argument
addNotification(message, type, data, dontTranslate, options){undefined}
Parameters
Name |
Type |
Description |
message |
string
|
Notification message |
type |
string
|
Notification message type |
data |
array
|
An array of data strings that are to be applied to notification |
dontTranslate |
Boolean
|
Flag to prevent automatic notification translation |
options |
Object
|
Additional notification options |
Displays app notification
Notification message is being interpolated by replacing placeholders
such as '{1}', '{2}' etc. by corresponding values from 'data' argument
addUserMessage(message, type, data, important, dontTranslate, force, passToDebug){undefined}
Parameters
Name |
Type |
Description |
message |
string
|
Message to be logged |
type |
string
|
Type of log message (debug, info, warning, error) |
data |
array
|
An array of data strings that are to be applied to logging message |
important |
Boolean
|
Flag to indicate message importance |
dontTranslate |
Boolean
|
Flag to prevent automatic message translation |
force |
Boolean
|
Flag to force message output even if configuration wouldn't allow it |
passToDebug |
Boolean
|
Flag to force passing same message to debug log |
Logs user message if conditions are met
Message is being interpolated by replacing placeholders
such as '{1}', '{2}' etc. by corresponding values from 'data' argument
asyncMessage(data){mixed}
Parameters
Name |
Type |
Description |
data |
Object
|
Message data object |
Emits 'asyncMessage' global event, listened by main script
asyncMessageInfo(data, verboseOutput){Object}
Parameters
Name |
Type |
Description |
data |
Object
|
Message data.data object |
verboseOutput |
Boolean
|
Toggles verbose output |
Returns info on async messages that can be passed to mainScript
autoTrimTranslations(){undefined}
Detects unused labels in app and removes them from translation files automatically
changeLanguage(e){undefined}
Parameters
Name |
Type |
Description |
e |
Event
|
Event that triggered the method |
Handler method for changing app language
charTransliteration(text, direction){String}
Parameters
Name |
Type |
Description |
text |
String
|
Text to transliterate |
direction |
String
|
Direction for transliteration ('c2l', 'l2c' or 'yu2ascii') |
Transliterates char to char using charmap
clearIntervals(){undefined}
Clears all intervals bound to this AppWrapper instance
clearTimeouts(){undefined}
Clears all timeouts bound to this AppWrapper instance
destroy(){undefined}
Destructor method - cleans up references for this instance
freeing memory upon object destruction
doChangeLanguage(selectedName, selectedCode, selectedLocale, skipOtherWindow){boolean}
Parameters
Name |
Type |
Description |
selectedName |
string
|
New app language name |
selectedCode |
string
|
New app language code |
selectedLocale |
string
|
New app language locale |
skipOtherWindow |
boolean
|
Flag to indicate whether to skip changing languages in other windows |
Method that changes current app language
finalize(){Boolean}
Finalizes current class instance, setting up any additional properties
etc. Entire app structure, including frontend app is available here
getAppState(){Object}
Helper method to get appState object
getAppWrapper(){AppWrapper}
Helper method to get appWrapper instance
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
getDebugMessageFileLine(message){string}
Parameters
Name |
Type |
Description |
message |
obj
|
Message object to be logged (returned by this.getMessageObject method) |
Returns string representing log line for appending
to debug log file
getDebugMessageFilePath(){string}
Returns path to debug message log file
getExcessLabels(){array}
Detects and returns unused labels in 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)
getLanguageFilePath(languageCode){string}
Parameters
Name |
Type |
Description |
languageCode |
string
|
Language code to get path for |
Returns absolute path to translations data file for given langauge code
getMessageFileLine(message){string}
Parameters
Name |
Type |
Description |
message |
obj
|
Message object to be logged (returned by this.getMessageObject method) |
Gets JSON represenation of message object for saving into log file,
removing unneccessary properties and adding necessary ones
getMessageObject(messageLevel, message, type, data, important, dontTranslate, force){Object}
Parameters
Name |
Type |
Description |
messageLevel |
int
|
Number representing current message level (0=debug, 1=info, 2=warning, 3=error) |
message |
string
|
Message to be logged |
type |
string
|
Type of log message (debug, info, warning, error) |
data |
array
|
An array of data strings that are to be applied to logging message |
important |
Boolean
|
Flag to indicate message importance |
dontTranslate |
Boolean
|
Flag to prevent automatic message translation |
force |
Boolean
|
Flag to force message output even if configuration wouldn't allow it |
Returns prepared message object based on passed arguments.
Message is being interpolated by replacing placeholders
such as '{1}', '{2}' etc. by corresponding values from 'data' argument
getMessageObjectRow(index, messageRowData){Object}
Parameters
Name |
Type |
Description |
index |
mixed
|
Key or array index |
messageRowData |
Object
|
Message row data for logging |
Gets single row for tabular message logging
getNewLabel(label){string}
Parameters
Name |
Type |
Description |
label |
string
|
Label name |
Returns default value for untranslated labels
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
getTableMessageData(message){Object}
Parameters
Name |
Type |
Description |
message |
Object
|
Tabular data |
Prepares table data for tabular message logging
getTranslationDataString(translationData){string}
Parameters
Name |
Type |
Description |
translationData |
Object
|
Object with translation data |
Prepares and returns translation data string for saving in translation file
getTranslationEditorData(){Object}
Prepares config editor data object for config-editor component
getTranslationsDir(){string}
Returns current translations directory
getTransliterateData(){Object}
Returns data used for transliteration
getUserMessageFileLine(message){string}
Parameters
Name |
Type |
Description |
message |
obj
|
Message object to be logged (returned by this.getMessageObject method) |
Returns string representing log line for appending
to user message log file
getUserMessageFilePath(){string}
Returns path to user message log file
globalEmit(eventName, data){undefined}
Parameters
Name |
Type |
Description |
eventName |
String
|
Name of the event |
data |
Object
|
Event data object |
Emits event to globalEmitter (listened by both main script and app code)
googleTranslate(text, to, from){String}
Parameters
Name |
Type |
Description |
text |
String
|
Text to translate |
to |
String
|
Source language code |
from |
String
|
Destination language code |
Translates text using google-translate-api module
Initializes current class instance, setting up logging and
bound methods to be used in event listeners
initializeLanguage(){Object}
Initializes language data, loading available languages and their translations
Parameters
Name |
Type |
Description |
options |
Object
|
Options for logging initialization (currently only 'silent' property is used, determining whether warnings should be printed if no config found) |
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)
isDebugEnabled(){Boolean}
Checks whether debug mode is on
loadTranslations(){Object}
Loads translations from translation files
loadTranslationsFromDir(translationsPath, translationExtensionRegex, asString){Object}
Parameters
Name |
Type |
Description |
translationsPath |
string
|
Absolute path to directory containing translation files |
translationExtensionRegex |
RegExp
|
Regular expression for matching file names containing translation data |
asString |
boolean
|
Flag to indicate whether to return file contents as string or require() it |
Loads all translation data from directory passed in argument
log(message, type, data, force){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 |
Logs debug message if conditions are met
Message is being interpolated by replacing placeholders
such as '{1}', '{2}' etc. by corresponding values from 'data' argument
message(data){undefined}
Parameters
Name |
Type |
Description |
data |
Object
|
Event data object |
Emits 'message' global event, listened by main script
messageInfo(data, verboseOutput){Object}
Parameters
Name |
Type |
Description |
data |
Object
|
Message data.data object |
verboseOutput |
Boolean
|
Toggles verbose output |
Returns info on messages that can be passed to mainScript
messageInfoOutput(messageData, verboseOutput){undefined}
Parameters
Name |
Type |
Description |
messageData |
Object
|
Message response data |
verboseOutput |
Boolean
|
Toggles verbose output |
Logs messages info to console
multiReplace(text, multiMap){String}
Parameters
Name |
Type |
Description |
text |
String
|
Text to replace |
multiMap |
Array.<Array>
|
An array of arrays (patterns and replacements) for regex |
multiReplace - replaces all occurrences of all present elements of multiMap[0] with multiMap[1] in a string and returns the string
openLanguageEditor(e){undefined}
Parameters
Name |
Type |
Description |
e |
Event
|
Event that triggered the method |
Opens translation editor modal
openTranslationEditor(e){undefined}
Parameters
Name |
Type |
Description |
e |
Event
|
Event that triggered the method |
Opens translation editor modal
removeBoundMethods(){undefined}
Method that cleans up this.boundMethods property
set in this.addBoundMethods method
removeEventListeners(){undefined}
Removes event listeners for this object
resetAppError(){undefined}
Resets (turns off) application error, removing app-error component
saveTranslations(e){undefined}
Parameters
Name |
Type |
Description |
e |
Event
|
Event that triggered the method |
Saves translations to translation files
scanAppTranslations(){array}
Scans app files labels and returns them
setAppError(title, text, debugText, data, doNotTranslate, messageType, omitIcon){undefined}
Parameters
Name |
Type |
Description |
title |
String
|
App error title |
text |
String
|
App error text |
debugText |
String
|
App error debug text (shown only if debug is enabled) |
data |
Array.<String>
|
An array with replacement data for error title, text and debugText |
doNotTranslate |
Boolean
|
Flag to prevent automatic traslation of title and text |
messageType |
String
|
null
|
Type of messages to show in app-error ('user', 'debug' or null) |
omitIcon |
Boolean
|
Flag to control app-error icon rendering |
Sets (turns on) application error, triggering rendering of app-error component
translate(label, currentLanguage, data){string}
Parameters
Name |
Type |
Description |
label |
string
|
Label for translation |
currentLanguage |
string
|
Current language code |
data |
array
|
An array of data strings to be used for interpolation |
Returns translated value for passed label
Translation is being interpolated by replacing placeholders
such as '{1}', '{2}' etc. by corresponding values from 'data' argument
transliterateText(text, direction){String}
Parameters
Name |
Type |
Description |
text |
String
|
Text to transliterate |
direction |
String
|
Direction for transliteration ('c2l', 'l2c' or 'yu2ascii') |
Takes text string as parameter and transliterates it based on set options