Skip to content

Commit

Permalink
namespacify local storage key
Browse files Browse the repository at this point in the history
  • Loading branch information
milushov committed Sep 22, 2013
1 parent 1747451 commit 78d9f2e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/better_errors/templates/main.erb
Original file line number Diff line number Diff line change
Expand Up @@ -794,9 +794,9 @@
function REPL(index) {
this.index = index;

var previousCommands = JSON.parse(localStorage.getItem("previousCommands"));
var previousCommands = JSON.parse(localStorage.getItem("better_errors_previous_commands"));
if(previousCommands === null) {
localStorage.setItem("previousCommands", JSON.stringify([]));
localStorage.setItem("better_errors_previous_commands", JSON.stringify([]));
previousCommands = [];
}

Expand Down Expand Up @@ -870,20 +870,20 @@
REPL.prototype.onEnterKey = function() {
var text = this.getInput();
if(text != "" && text !== undefined) {
var previousCommands = JSON.parse(localStorage.getItem("previousCommands"));
var previousCommands = JSON.parse(localStorage.getItem("better_errors_previous_commands"));
this.previousCommandOffset = previousCommands.push(text);
if(previousCommands.length > 100) {
previousCommands.splice(0, 1);
}
localStorage.setItem("previousCommands", JSON.stringify(previousCommands));
localStorage.setItem("better_errors_previous_commands", JSON.stringify(previousCommands));
}
this.setInput("");
this.sendInput(text);
};

REPL.prototype.onNavigateHistory = function(direction) {
this.previousCommandOffset += direction;
var previousCommands = JSON.parse(localStorage.getItem("previousCommands"));
var previousCommands = JSON.parse(localStorage.getItem("better_errors_previous_commands"));

if(this.previousCommandOffset < 0) {
this.previousCommandOffset = -1;
Expand Down

0 comments on commit 78d9f2e

Please sign in to comment.