From 23274299bf5ab948ff5b171d19de68de232da6f9 Mon Sep 17 00:00:00 2001 From: raphael Date: Fri, 11 Jan 2019 11:33:43 +0100 Subject: [PATCH] refactor whiteboard storage --- s_whiteboard.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/s_whiteboard.js b/s_whiteboard.js index a9b62f9..ad35b44 100644 --- a/s_whiteboard.js +++ b/s_whiteboard.js @@ -22,7 +22,7 @@ module.exports = { } } } - } else if(tool==="line" || tool==="pen" || tool==="rect" || tool==="circle" || tool==="eraser" || tool==="addImgBG" || tool==="recSelect" || tool==="eraseRec") { //Save all this actions + } else if(["line", "pen", "rect", "circle", "eraser", "addImgBG", "recSelect", "eraseRec"].includes(tool)) { //Save all this actions if(!savedBoards[wid]) { savedBoards[wid] = []; } @@ -31,9 +31,6 @@ module.exports = { } }, loadStoredData : function(wid) { //Load saved whiteboard - if(!savedBoards[wid]) { - return []; - } - return savedBoards[wid]; + return savedBoards[wid] ? savedBoards[wid] : []; } } \ No newline at end of file