From 705d465a01b1acc86a42789ba50969718c7924e1 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 11 Jan 2017 19:59:49 +0000 Subject: [PATCH] Reorder storage.js --- src/app/storage.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/app/storage.js b/src/app/storage.js index f8c054802f..fb9250d258 100644 --- a/src/app/storage.js +++ b/src/app/storage.js @@ -1,33 +1,33 @@ 'use strict' function Storage () { - this.rename = function (originalName, newName) { - var content = this.get(originalName) - this.set(newName, content) - this.remove(originalName) - } - - this.remove = function (name) { - window.localStorage.removeItem(name) - } - this.exists = function (key) { return !!this.get(key) } - this.set = function (key, content) { - window.localStorage.setItem(key, content) - } - this.get = function (key) { return window.localStorage.getItem(key) } + this.set = function (key, content) { + window.localStorage.setItem(key, content) + } + this.keys = function () { // NOTE: this is a workaround for some browsers return Object.keys(window.localStorage).filter(function (item) { return item !== null && item !== undefined }) } + this.remove = function (name) { + window.localStorage.removeItem(name) + } + + this.rename = function (originalName, newName) { + var content = this.get(originalName) + this.set(newName, content) + this.remove(originalName) + } + this.loadFile = function (filename, content) { if (this.exists(filename) && this.get(filename) !== content) { var count = ''