Add a localstorage.js module

(imported from commit 9f3ab248ce84ce296bb1fb918de3b2dd8cde1ded)
This commit is contained in:
Leo Franchi 2014-01-16 10:42:30 -05:00
parent e24dcb3952
commit 24cb5fb079
3 changed files with 25 additions and 0 deletions

21
static/js/localstorage.js Normal file
View File

@ -0,0 +1,21 @@
var localstorage = (function () {
var exports = {};
var warned_of_localstorage = false;
exports.supported = function supports_localstorage() {
try {
return window.hasOwnProperty('localStorage') && window.localStorage !== null;
} catch (e) {
if (!warned_of_localstorage) {
blueslip.error("Client browser does not support local storage, will lose socket message on reload");
warned_of_localstorage = true;
}
return false;
}
};
return exports;
}());

View File

@ -44,6 +44,9 @@ var globals =
// echo.js
+ ' echo'
// localstorage.js
+ ' localstorage'
// zulip.js
+ ' all_msg_list home_msg_list narrowed_msg_list current_msg_list get_updates_params'
+ ' add_messages'

View File

@ -512,6 +512,7 @@ JS_SPECS = {
'js/summary.js',
'js/util.js',
'js/dict.js',
'js/localstorage.js',
'js/channel.js',
'js/muting.js',
'js/muting_ui.js',