rename methods
gitea/mylogger/pipeline/pr-master This commit looks good Details

This commit is contained in:
Javier Segarra 2024-05-10 22:11:24 +02:00
parent bd48afa684
commit b53b03b81c
2 changed files with 5 additions and 5 deletions

View File

@ -19,9 +19,9 @@ module.exports = class Salix {
this._salixVersion = null;
this._salixConfig = null;
}
fooListener(val) {}
registerNewListener(externalListenerFunction) {
this.fooListener = externalListenerFunction;
emit() {}
subscribe(externalListenerFunction) {
this.emit = externalListenerFunction;
}
async init(logger) {
this.conf = logger.conf;
@ -180,7 +180,7 @@ module.exports = class Salix {
return this._salixVersion;
}
set salixVersion(newVersion) {
if(this._salixVersion) this.fooListener(newVersion);
if(this._salixVersion && (this._salixVersion!== newVersion)) this.emit(newVersion);
this._salixVersion = newVersion;
}

View File

@ -22,7 +22,7 @@ module.exports = class MyLogger {
async start() {
const conf = (this.conf = loadConfig(__dirname, 'config'));
const salix = new Salix();
salix.registerNewListener(() => {
salix.subscribe(( ) => {
this.stop();
this.start();
});