easy-mock-client
Version:
using easy mock as sdk or cli
29 lines (23 loc) • 469 B
JavaScript
class BaseCommand {
constructor() {
this.context = {}
this.handler = null
this.client = null
}
getParams() {
return this.context
}
setParams(context) {
this.context = context
}
register(context, handler) {
this.handler = handler
this.context = context
}
execute(client) {
if (typeof this.handler === 'function') {
return this.handler.call(this, client, this.context)
}
}
}
module.exports = BaseCommand