Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modules modernization #412

Merged
merged 52 commits into from
Dec 11, 2020
Merged
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2254fd0
var => const/let + other modernizations
Oct 29, 2020
fa23f47
replaced var with const in examples
Oct 29, 2020
088e53b
code modernization
Oct 29, 2020
caff111
code modernization, removed obsolete require of Binary, ByteArray and…
Oct 29, 2020
88eaa88
code modernization, added tests for net module
Oct 29, 2020
efbc42b
code modernization
Oct 29, 2020
9213031
code modernization
Oct 29, 2020
3fdd099
code modernization, added test for help() method
Oct 31, 2020
26207a8
code modernization
Oct 31, 2020
b0bac7e
code modernization
Oct 31, 2020
dca4046
use require instead of include in code example to make things explicit
Nov 2, 2020
cc17fbd
avoid redeclaration of consts
Nov 2, 2020
5ca27db
modernized/simplified code, added test for Semaphore
Nov 2, 2020
3fc56f2
code modernization
Nov 2, 2020
f7dabd3
code modernization (ie. var -> const/let)
Nov 2, 2020
ae0def5
code modernization (ie. var -> const/let)
Nov 2, 2020
8a54199
code modernization (ie. var -> const/let)
Nov 2, 2020
52eb27a
code modernization (ie. var -> const/let)
Nov 2, 2020
da34dbd
code modernization
Nov 2, 2020
8f4f2c3
code modernization (ie. var -> const/let)
Nov 2, 2020
27640b5
bugfix: arrow functions have no arguments object
Nov 2, 2020
6399f07
code modernization
Nov 2, 2020
3630d6f
code modernization (ie. var -> const/let)
Nov 2, 2020
305f511
code modernization (ie. var -> const/let)
Nov 2, 2020
24ff785
code modernization (ie. var -> const/let)
Nov 2, 2020
f9d3aa2
replaced include() in code example with more explicit require
Nov 2, 2020
9800eb2
code modernization (ie. var -> const/let), ZipIterator is now a Gener…
Nov 2, 2020
9179851
added missing tests
Nov 2, 2020
a278580
code modernization (ie. var -> const/let)
Nov 2, 2020
09184bc
code modernization (ie. var -> const/let)
Nov 2, 2020
1f47930
code modernization (ie. var -> const/let)
Nov 2, 2020
1e92bbe
code modernization (ie. var -> const/let)
Nov 2, 2020
0362ea2
code modernization (ie. var -> const/let)
Nov 2, 2020
1268b7a
use strict comparisons and 0o1234 for octals, minor code formatting
Nov 2, 2020
87f41a4
code modernization (ie. var -> const/let), fixed an error in parseFil…
Nov 2, 2020
c8fde04
code modernization (ie. var -> const/let)
Nov 2, 2020
07046a8
code modernization (ie. var -> const/let)
Nov 2, 2020
fcbb093
code modernization (ie. var -> const/let)
Nov 2, 2020
d406b5f
stack traces now exclude the test module too, code modernization
Nov 3, 2020
7d999ba
code modernization
Nov 3, 2020
81ed270
#409 implemented binary.toByteString() as replacement of the
Nov 3, 2020
d5547a4
minor: simplified named exports
Nov 3, 2020
d43a229
regression fix: short option can be null/undefined
Nov 3, 2020
bc00d84
modified prototype construction of AssertionError and
Nov 3, 2020
de3e2e4
regression fix: printResult and printError must be declared as local …
Nov 4, 2020
556bcc7
regression fix: objects.merge() must handle null/undefined arguments
Nov 4, 2020
73a093a
fixed variable declaration
Nov 4, 2020
7b34b34
added worker test
Nov 4, 2020
2da80dc
fixed write/writeln method binding
Nov 4, 2020
18bb889
reverted change to arrow functions to maintain correct scope
Nov 4, 2020
b8f35ce
fixed & modernized examples
Nov 4, 2020
2965bf1
#409 binary module no longer modifies the String prototype
Nov 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
code modernization
Robert Gaggl committed Nov 2, 2020
commit 3fc56f20eedcd10433a02c64839c007043a5cda6
29 changes: 12 additions & 17 deletions modules/ringo/daemon.js
Original file line number Diff line number Diff line change
@@ -9,23 +9,23 @@
* as argument to the application life cycle functions.
*/

var system = require('system');
var log = require('ringo/logging').getLogger(module.id);
const system = require('system');
const log = require('ringo/logging').getLogger(module.id);

var app;
let app;

/**
* Called when the daemon instance is created.
*
* This function can be run with superuser id to perform privileged actions
* before the daemon is started.
*/
function init() {
exports.init = () => {
log.info("init", system.args);
// Remove our own script name from args
system.args.shift();
if (system.args.length) {
var appId = system.args[0];
const appId = system.args[0];
try {
app = require(appId);
} catch (error) {
@@ -38,39 +38,34 @@ function init() {
if (app && typeof app.init === "function") {
app.init();
}
}
};

/**
* Called when the daemon instance is started.
*/
function start() {
exports.start = () => {
log.info("start");
if (app && typeof app.start === "function") {
app.start();
}
}
};

/**
* Called when the daemon is stopped.
*/
function stop() {
exports.stop = () => {
log.info("stop");
if (app && typeof app.stop === "function") {
app.stop();
}
}
};

/**
* Called when the daemon is destroyed.
*/
function destroy() {
exports.destroy = () => {
log.info("destroy");
if (app && typeof app.destroy === "function") {
app.destroy();
}
}

module.exports.init = init;
module.exports.start = start;
module.exports.stop = stop;
module.exports.destroy = destroy;
};