From fe0c51375ac3f0105b7df3e6bb16a2d5bd54259d Mon Sep 17 00:00:00 2001 From: Mansehej Singh Date: Thu, 30 Jul 2020 02:30:44 +0530 Subject: [PATCH] Change isCallbackSet from function call to Boolean constant --- bin/callback.js | 10 +--------- bin/utils.js | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/bin/callback.js b/bin/callback.js index f9acc27..1bc0444 100644 --- a/bin/callback.js +++ b/bin/callback.js @@ -4,15 +4,7 @@ const CALLBACK_URL = process.env.CALLBACK_URL ? new URL(process.env.CALLBACK_URL const CALLBACK_TIMEOUT = process.env.CALLBACK_TIMEOUT || 5000 const CALLBACK_OBJECTS = process.env.CALLBACK_OBJECTS ? JSON.parse(process.env.CALLBACK_OBJECTS) : {} -/** - * @return {Boolean} - */ -exports.isCallbackSet = () => { - if (CALLBACK_URL) { - return true - } - return false -} +exports.isCallbackSet = !!CALLBACK_URL /** * @param {Uint8Array} update diff --git a/bin/utils.js b/bin/utils.js index 5e2cb08..1138961 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -118,7 +118,7 @@ class WSSharedDoc extends Y.Doc { } this.awareness.on('update', awarenessChangeHandler) this.on('update', updateHandler) - if (isCallbackSet()) { + if (isCallbackSet) { this.on('update', debounce( callbackHandler, CALLBACK_DEBOUNCE_WAIT,