mediawiki.storage: Document 'null' return from get()
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 15 Jun 2017 20:25:45 +0000 (21:25 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 15 Jun 2017 20:25:45 +0000 (21:25 +0100)
Follows-up 7daab75414d. Forgot to document the full return scope
of HTML Storage#get, which is 'string or null'.

We may want to consider changing the 'false' return to 'null', so
that the concept of "localStorage disabled" is entirely hidden
behind the regular return values (null in case of #get).

Change-Id: I6bed62457d2e64831ec8241e16f7e8c85c6531a4

resources/src/mediawiki/mediawiki.storage.js

index 95c77f8..84e146a 100644 (file)
@@ -32,7 +32,8 @@
         * Retrieve value from device storage.
         *
         * @param {string} key Key of item to retrieve
-        * @return {string|boolean} False when localStorage not available, otherwise string
+        * @return {string|null|boolean} String value, null if no value exists, or false
+        *  if localStorage is not available.
         */
        SafeStorage.prototype.get = function ( key ) {
                try {