Skip to content

Commit

Permalink
MDL-70106 cache: Set icon localstorage cache to use theme localisation
Browse files Browse the repository at this point in the history
  • Loading branch information
Peterburnett committed Nov 4, 2020
1 parent 58ba94a commit 7fe1554
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/amd/build/icon_system_fontawesome.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/amd/build/icon_system_fontawesome.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions lib/amd/src/icon_system_fontawesome.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ define(['core/icon_system', 'jquery', 'core/ajax', 'core/mustache', 'core/locals
* @return {Promise}
*/
IconSystemFontawesome.prototype.init = function() {
var currTheme = M.cfg.theme;

if (staticMap) {
return $.when(this);
}

var map = LocalStorage.get('core/iconmap-fontawesome');
var map = LocalStorage.get('core_iconsystem/theme/' + currTheme + '/core/iconmap-fontawesome');
if (map) {
map = JSON.parse(map);
}
Expand All @@ -70,7 +72,7 @@ define(['core/icon_system', 'jquery', 'core/ajax', 'core/mustache', 'core/locals
$.each(map, function(index, value) {
staticMap[value.component + '/' + value.pix] = value.to;
});
LocalStorage.set('core/iconmap-fontawesome', JSON.stringify(staticMap));
LocalStorage.set('core_iconsystem/theme/' + currTheme + '/core/iconmap-fontawesome', JSON.stringify(staticMap));
return this;
}.bind(this));
};
Expand Down

0 comments on commit 7fe1554

Please sign in to comment.