From 4349d438c7443dc15668b73c35a7065682bc7d6e Mon Sep 17 00:00:00 2001 From: itayw Date: Mon, 10 Mar 2014 11:36:52 +0200 Subject: [PATCH] #29 added force option [temporary] --- bin/joola.io.js | 7 ++++--- lib/viz/Sparkline.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/joola.io.js b/bin/joola.io.js index c697217..ce76b49 100644 --- a/bin/joola.io.js +++ b/bin/joola.io.js @@ -257,15 +257,16 @@ if (joolaio.options.APIToken) { joolaio.init({}); } -joolaio.set = function (key, value) { +joolaio.set = function (key, value, callback) { joolaio.options[key] = value; if (key === 'APIToken') { joolaio.dispatch.users.verifyAPIToken(joolaio.options.APIToken, function (err, user) { if (err) - throw err; + return callback(err); joolaio.USER = user; + return callback(null); }); } }; @@ -3873,7 +3874,7 @@ joolaio.events.on('core.init.finish', function () { $.fn.Sparkline = function (options, callback) { var result = null; var uuid = this.attr('jio-uuid'); - if (!uuid) { + if (!uuid || options.force) { //create new if (!options) options = {}; diff --git a/lib/viz/Sparkline.js b/lib/viz/Sparkline.js index bf1b2ec..45d6da2 100644 --- a/lib/viz/Sparkline.js +++ b/lib/viz/Sparkline.js @@ -167,7 +167,7 @@ joolaio.events.on('core.init.finish', function () { $.fn.Sparkline = function (options, callback) { var result = null; var uuid = this.attr('jio-uuid'); - if (!uuid) { + if (!uuid || options.force) { //create new if (!options) options = {};