From 0e82819d30a5d101fb9fbe00458bdcc45205983a Mon Sep 17 00:00:00 2001 From: Daniel Nalborczyk Date: Sat, 6 Aug 2022 22:08:34 -0400 Subject: [PATCH] refactor: declare fields, remove from constructor --- src/ServerlessOffline.js | 58 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/ServerlessOffline.js b/src/ServerlessOffline.js index 16f3f2457..061e7390a 100644 --- a/src/ServerlessOffline.js +++ b/src/ServerlessOffline.js @@ -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'