Skip to content

Commit

Permalink
[WIP] improve loading of preferences
Browse files Browse the repository at this point in the history
As suggested by Wolfgang in today's Community Call. (Note the "Uncaught TypeError" comment.)
  • Loading branch information
joewiz committed Jul 19, 2021
1 parent 49cf8ce commit ced6868
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ eXide.util.Preferences = (function () {
indentOnLoad: true,
expandXIncludesOnLoad: false,
softWrap: -1,
emmet: false
emmet: false,
version: "3.1.0" // eXide.app.version() returns "Uncaught TypeError: Cannot read property 'version' of undefined"
};

Constr = function(editor) {
Expand Down Expand Up @@ -173,7 +174,7 @@ eXide.util.Preferences = (function () {
Constr.prototype.read = function() {
var sameVersion = false;
if (localStorage["eXide.preferences"]) {
this.preferences = JSON.parse(localStorage.getItem("eXide.preferences"));
this.preferences = Object.assign(defaultPreferences, JSON.parse(localStorage.getItem("eXide.preferences")));
sameVersion = (this.preferences.version === eXide.app.version());
}

Expand Down

0 comments on commit ced6868

Please sign in to comment.