[BUGFIX] Fix handling of Storage.Client 36/54236/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 28 Sep 2017 13:17:14 +0000 (15:17 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Fri, 29 Sep 2017 15:45:58 +0000 (17:45 +0200)
The "Storage" module gets the missing "unset" method to remove values
from localStorage. The "isset" method is fixed to determine whether
a value is really existing.

Resolves: #82613
Releases: master, 8.7
Change-Id: Icb4b862b380811a7ba7f897be3c4809b718d2810
Reviewed-on: https://review.typo3.org/54236
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/backend/Resources/Public/JavaScript/Storage.js

index 27339cd..8ea9769 100644 (file)
@@ -58,6 +58,7 @@ define(['jquery'], function ($) {
        /**
         * Simple localStorage wrapper, to get value from localStorage
         * @param {String} key
+        * @return {String}
         */
        Storage.Client.get = function(key) {
                return localStorage.getItem('t3-' + key);
@@ -69,7 +70,15 @@ define(['jquery'], function ($) {
         * @param {String} value
         */
        Storage.Client.set = function(key, value) {
-               return localStorage.setItem('t3-' + key, value);
+               localStorage.setItem('t3-' + key, value);
+       };
+
+       /**
+        * Simple localStorage wrapper, to unset value from localStorage
+        * @param {String} key
+        */
+       Storage.Client.unset = function(key) {
+               localStorage.removeItem('t3-' + key);
        };
 
        /**
@@ -87,7 +96,7 @@ define(['jquery'], function ($) {
         */
        Storage.Client.isset = function(key) {
                var value = this.get(key);
-               return (typeof value !== 'undefined' && typeof value !== 'null' && value != 'undefined');
+               return (typeof value !== 'undefined' && value !== null);
        };
 
        /**