Skip to content

Commit cbe98ec

Browse files
committed
Move usableLocalStorage() above functions that make use of it
1 parent 8362aa2 commit cbe98ec

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/librustdoc/html/static/storage.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,6 @@ function onEach(arr, func) {
2626
return false;
2727
}
2828

29-
function updateLocalStorage(name, value) {
30-
if (usableLocalStorage()) {
31-
localStorage[name] = value;
32-
} else {
33-
// No Web Storage support so we do nothing
34-
}
35-
}
36-
37-
function getCurrentValue(name) {
38-
if (usableLocalStorage() && localStorage[name] !== undefined) {
39-
return localStorage[name];
40-
}
41-
return null;
42-
}
43-
4429
function usableLocalStorage() {
4530
// Check if the browser supports localStorage at all:
4631
if (typeof(Storage) === "undefined") {
@@ -59,6 +44,21 @@ function usableLocalStorage() {
5944
return true;
6045
}
6146

47+
function updateLocalStorage(name, value) {
48+
if (usableLocalStorage()) {
49+
localStorage[name] = value;
50+
} else {
51+
// No Web Storage support so we do nothing
52+
}
53+
}
54+
55+
function getCurrentValue(name) {
56+
if (usableLocalStorage() && localStorage[name] !== undefined) {
57+
return localStorage[name];
58+
}
59+
return null;
60+
}
61+
6262
function switchTheme(styleElem, mainStyleElem, newTheme) {
6363
var fullBasicCss = "rustdoc" + resourcesSuffix + ".css";
6464
var fullNewTheme = newTheme + resourcesSuffix + ".css";

0 commit comments

Comments
 (0)