From 6073add93e25b4e3a39f1ba4fe0311d4cd5f992c Mon Sep 17 00:00:00 2001 From: Dmitri Date: Thu, 1 Feb 2018 12:19:12 +0700 Subject: [PATCH] Change default back to zero --- component/Bubbles.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/component/Bubbles.js b/component/Bubbles.js index 7c60d3f..b140e6b 100644 --- a/component/Bubbles.js +++ b/component/Bubbles.js @@ -6,7 +6,7 @@ function Bubbles(container, self, options) { typeSpeed = options.typeSpeed || 5 // delay per character, to simulate the machine "typing" widerBy = options.widerBy || 2 // add a little extra width to bubbles to make sure they don't break sidePadding = options.sidePadding || 6 // padding on both sides of chat bubbles - recallInteractions = options.recallInteractions || 10 // number of interactions to be remembered and brought back upon restart + recallInteractions = options.recallInteractions || 0 // number of interactions to be remembered and brought back upon restart inputCallbackFn = options.inputCallbackFn || false // should we display an input field? var standingAnswer = "ice" // remember where to restart convo if interrupted @@ -27,7 +27,7 @@ function Bubbles(container, self, options) { return false } } - var localStorageAvailable = localStorageCheck() + var localStorageAvailable = localStorageCheck() && recallInteractions > 0 var interactionsLS = "chat-bubble-interactions" var interactionsHistory = localStorageAvailable && JSON.parse(localStorage.getItem(interactionsLS)) || [] @@ -36,7 +36,7 @@ function Bubbles(container, self, options) { interactionsSave = function(say, reply) { if(!localStorageAvailable) return // limit number of saves - if (interactionsHistory.length >= recallInteractions) + if (interactionsHistory.length > recallInteractions) interactionsHistory.shift() // removes the oldest (first) save to make space // do not memorize buttons; only user input gets memorized: