Philipp Muens ce2c889661 Update naming of "before" and "after" hooks
Update the naming so that it matches the new naming pattern.
"before" and "after" are always prepended so that we don't run into
problems when a function already includes a "before" or "after".
2016-05-18 16:21:12 +02:00

43 lines
796 B
JavaScript

'use strict';
class HelloWorld {
constructor() {
this.commands = {
greet: {
usage: 'Foo',
lifeCycleEvents: [
'printGoodMorning',
'printHello',
'printGoodEvening'
]
},
};
this.hooks = {
'before:greet:printHelloWorld': this.printGoodMorning,
'greet:printHelloWorld': this.printHello,
'after:greet:printHelloWorld': this.printGoodEvening,
};
}
printGoodMorning() {
const message = 'Good morning';
console.log(message);
return message;
}
printHello() {
const message = 'Hello';
console.log(message);
return message;
}
printGoodEvening() {
const message = 'Good evening';
console.log(message);
return message;
}
}
module.exports = HelloWorld;