mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:02:46 +08:00
Oops I missed a couple of jshint errors :)
This commit is contained in:
parent
2a7345b96e
commit
3e201fc9f3
|
@ -4,25 +4,25 @@
|
|||
@class KeyValueStore
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
**/
|
||||
Discourse.KeyValueStore = {
|
||||
initialized: false,
|
||||
context: "",
|
||||
|
||||
init: function(ctx, messageBus) {
|
||||
initialized = true;
|
||||
context = ctx;
|
||||
this.initialized = true;
|
||||
this.context = ctx;
|
||||
},
|
||||
|
||||
abandonLocal: function() {
|
||||
var i, k;
|
||||
if (!(localStorage && initialized)) {
|
||||
if (!(localStorage && this.initialized)) {
|
||||
return;
|
||||
}
|
||||
i = localStorage.length - 1;
|
||||
while (i >= 0) {
|
||||
k = localStorage.key(i);
|
||||
if (k.substring(0, context.length) === context) {
|
||||
if (k.substring(0, this.context.length) === this.context) {
|
||||
localStorage.removeItem(k);
|
||||
}
|
||||
i--;
|
||||
|
@ -31,21 +31,21 @@ Discourse.KeyValueStore = {
|
|||
},
|
||||
|
||||
remove: function(key) {
|
||||
return localStorage.removeItem(context + key);
|
||||
return localStorage.removeItem(this.context + key);
|
||||
},
|
||||
|
||||
set: function(opts) {
|
||||
if (!(localStorage && initialized)) {
|
||||
if (!(localStorage && this.initialized)) {
|
||||
return false;
|
||||
}
|
||||
localStorage[context + opts.key] = opts.value;
|
||||
localStorage[this.context + opts.key] = opts.value;
|
||||
},
|
||||
|
||||
get: function(key) {
|
||||
if (!localStorage) {
|
||||
return null;
|
||||
}
|
||||
return localStorage[context + key];
|
||||
return localStorage[this.context + key];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Discourse.ModalBodyView = Discourse.View.extend({
|
|||
// Pass the errors to our errors view
|
||||
displayErrors: function(errors, callback) {
|
||||
this.set('parentView.parentView.modalErrorsView.errors', errors);
|
||||
typeof callback === "function" ? callback() : void 0;
|
||||
if (typeof callback === "function") callback();
|
||||
},
|
||||
|
||||
// Just use jQuery to show an alert. We don't need anythign fancier for now
|
||||
|
|
Loading…
Reference in New Issue
Block a user