From e0fb0954853882f725569188d9caa72ce8932241 Mon Sep 17 00:00:00 2001 From: Bob Date: Thu, 11 Sep 2014 03:40:53 +1000 Subject: [PATCH] Add support for clearing the bot memory --- source/bot.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/bot.js b/source/bot.js index db14048..4cb823f 100644 --- a/source/bot.js +++ b/source/bot.js @@ -315,6 +315,14 @@ bot.memory = { clearTimeout( this.saveIntervalId ); setTimeout( this.saveLoop.bind(this), this.saveInterval ); } + + clear : function () { + Object.iterate( localStorage, function ( key, val ) { + if ( key.startsWith('bot_') ) { + localStorage.removeItem(key); + } + }); + this.data = {}; }; bot.memory.loadAll();