Skip to content

Commit

Permalink
refactor: declare fields, remove from constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Aug 7, 2022
1 parent e907f89 commit 0e82819
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions src/ServerlessOffline.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,38 @@ export default class ServerlessOffline {

#webSocket = null

constructor(serverless, cliOptions) {
this.#cliOptions = cliOptions
this.#serverless = serverless

this.commands = {
offline: {
// add start nested options
commands: {
functionsUpdated: {
lifecycleEvents: ['cleanup'],
type: 'entrypoint',
},
start: {
lifecycleEvents: ['init', 'ready', 'end'],
options: commandOptions,
usage:
'Simulates API Gateway to call your lambda functions offline using backward compatible initialization.',
},
commands = {
offline: {
// add start nested options
commands: {
functionsUpdated: {
lifecycleEvents: ['cleanup'],
type: 'entrypoint',
},
start: {
lifecycleEvents: ['init', 'ready', 'end'],
options: commandOptions,
usage:
'Simulates API Gateway to call your lambda functions offline using backward compatible initialization.',
},
lifecycleEvents: ['start'],
options: commandOptions,
usage: 'Simulates API Gateway to call your lambda functions offline.',
},
}
lifecycleEvents: ['start'],
options: commandOptions,
usage: 'Simulates API Gateway to call your lambda functions offline.',
},
}

this.hooks = {
'offline:functionsUpdated:cleanup': this.#cleanupFunctions.bind(this),
'offline:start': this.#startWithExplicitEnd.bind(this),
'offline:start:end': this.end.bind(this),
'offline:start:init': this.start.bind(this),
'offline:start:ready': this.#ready.bind(this),
}
hooks = {
'offline:functionsUpdated:cleanup': this.#cleanupFunctions.bind(this),
'offline:start': this.#startWithExplicitEnd.bind(this),
'offline:start:end': this.end.bind(this),
'offline:start:init': this.start.bind(this),
'offline:start:ready': this.#ready.bind(this),
}

constructor(serverless, cliOptions) {
this.#cliOptions = cliOptions
this.#serverless = serverless
}

// Entry point for the plugin (sls offline) when running 'sls offline start'
Expand Down

0 comments on commit 0e82819

Please sign in to comment.