wilton/misc
Miscelanous functions.
More...
Functions | |
Boolean | isAndroid (Function|Undefined callback) |
Check whether current Wilton binary was compiled for Android. | |
Boolean | isLinux (Function|Undefined callback) |
Check whether current Wilton binary was compiled for Linux. | |
Boolean | isMac (Function|Undefined callback) |
Check whether current Wilton binary was compiled for macOS. | |
Boolean | isWindows (Function|Undefined callback) |
Check whether current Wilton binary was compiled for Windows. | |
Array | listRegisteredCalls (Function|Undefined callback) |
Return a list of registered Wilton calls. | |
Undefined | runGC (Function|Undefined callback) |
Run a garbage collector. | |
String | stdinReadline (Function|Undefined callback) |
Read a line from the STDIN . | |
Undefined | systemdNotify (String state, Function|Undefined callback) |
Notify systemd service manager. | |
Undefined | waitForSignal (Function|Undefined callback) |
Wait for Ctrl-C . | |
Object | wiltonConfig (Function|Undefined callback) |
Access wilton configuration. | |
Undefined | winscmStartDispatcher (String name, Function|Undefined callback) |
Connect the main thread of a wilton process to SCM. |
This module provides miscelanous functionality that doesn't belong to separate modules.
Boolean misc::isAndroid | ( | Function|Undefined | callback | ) |
Checks that compileTimeOS
parameter of wiltonConfig
is "android".
callback | Function|Undefined callback to receive result or error |
Boolean
true
if current Wilton binary was compiled for Android, false otherwise Boolean misc::isLinux | ( | Function|Undefined | callback | ) |
Checks that compileTimeOS
parameter of wiltonConfig
is "linux".
callback | Function|Undefined callback to receive result or error |
Boolean
true
if current Wilton binary was compiled for Linux, false otherwise Boolean misc::isMac | ( | Function|Undefined | callback | ) |
Checks that compileTimeOS
parameter of wiltonConfig
is "macos".
callback | Function|Undefined callback to receive result or error |
Boolean
true
if current Wilton binary was compiled for macOS, false otherwise Boolean misc::isWindows | ( | Function|Undefined | callback | ) |
Checks that compileTimeOS
parameter of wiltonConfig
is "windows".
callback | Function|Undefined callback to receive result or error |
Boolean
true
if current Wilton binary was compiled for Windows, false otherwise Array misc::listRegisteredCalls | ( | Function|Undefined | callback | ) |
Returns a list of call names, that can be used with wiltoncall
function.
callback | Function|Undefined callback to receive result or error |
Array
list of registered Wilton calls Undefined misc::runGC | ( | Function|Undefined | callback | ) |
Runs a garbage collector for the default JS engine in a current thread. Actual GC run may or may not be async from this call depending on an engine. For JSC engine different versions may behave differently in that regard.
callback | Function|Undefined callback to receive result or error |
Undefined
String misc::stdinReadline | ( | Function|Undefined | callback | ) |
Reads a line from the STDIN
of the current process. Blocks until the line is read.
callback | Function|Undefined callback to receive result or error |
String
line passed to STDIN
Undefined misc::systemdNotify | ( | String | state, |
Function|Undefined | callback | ||
) |
Sends message to systemd service manager using sd_notify
API, see: https://www.freedesktop.org/software/systemd/man/sd_notify.html
state | String message to send to systemd |
callback | Function|Undefined callback to receive result or error |
Undefined
Undefined misc::waitForSignal | ( | Function|Undefined | callback | ) |
Blocks curren thread untils Ctrl-C
will be typed by used in console (or SIGINT
or SIGTERM
signal will be received by other means).
This function is not intented to be used as a "general-use use signal handler".
It can be called only once is a single process, and is typically called from the main thread of the console application after the initialization of background services.
callback | Function|Undefined callback to receive result or error |
Undefined
Object misc::wiltonConfig | ( | Function|Undefined | callback | ) |
Returns configuration object that was used for wilton
initialization.
callback | Function|Undefined callback to receive result or error |
Object
configuration object with the following fields:String
name of the script engine that is used by defaultString
path to the Wilton directoryObject
system environment variables collected during the startupObject
RequireJS
configuration Undefined misc::winscmStartDispatcher | ( | String | name, |
Function|Undefined | callback | ||
) |
Connects the main thread of a wilton process to the Windos Service Control Manager. Call return after the SCM service is stopped.
name | String name of the SCM service |
callback | Function|Undefined callback to receive result or error |
Undefined