mirror of
https://github.com/iconify/iconify.git
synced 2024-11-09 23:00:56 +00:00
Add disableStorage function to SVG framework
This commit is contained in:
parent
2a1b3a2b8b
commit
0f3457b6ee
@ -112,18 +112,7 @@ export interface IconifyGlobal extends IconifyGlobal1, IconifyGlobal2 {}
|
||||
// Export dependencies
|
||||
export { IconifyGlobal as IconifyGlobalCommon, IconifyAPI };
|
||||
|
||||
/**
|
||||
* Global variable
|
||||
*/
|
||||
const Iconify: IconifyGlobal = ({
|
||||
// Load icons
|
||||
loadIcons: API.loadIcons,
|
||||
|
||||
// API providers
|
||||
addAPIProvider: setAPIConfig,
|
||||
|
||||
// Allow storage
|
||||
enableCache: (storage: IconifyCacheType, value: boolean) => {
|
||||
function toggleCache(storage: IconifyCacheType, value: boolean): void {
|
||||
switch (storage) {
|
||||
case 'local':
|
||||
case 'session':
|
||||
@ -136,6 +125,24 @@ const Iconify: IconifyGlobal = ({
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Global variable
|
||||
*/
|
||||
const Iconify: IconifyGlobal = ({
|
||||
// Load icons
|
||||
loadIcons: API.loadIcons,
|
||||
|
||||
// API providers
|
||||
addAPIProvider: setAPIConfig,
|
||||
|
||||
// Toggle storage
|
||||
enableCache: (storage: IconifyCacheType, value?: boolean) => {
|
||||
toggleCache(storage, typeof value === 'boolean' ? value : true);
|
||||
},
|
||||
disableCache: (storage: IconifyCacheType) => {
|
||||
toggleCache(storage, false);
|
||||
},
|
||||
|
||||
// Exposed internal functions
|
||||
|
@ -20,7 +20,8 @@ export interface IconifyAPI {
|
||||
/**
|
||||
* Toggle local and session storage
|
||||
*/
|
||||
enableCache: (storage: IconifyCacheType, value: boolean) => void;
|
||||
enableCache: (storage: IconifyCacheType, value?: boolean) => void;
|
||||
disableCache: (storage: IconifyCacheType) => void;
|
||||
|
||||
/**
|
||||
* Load icons
|
||||
|
Loading…
Reference in New Issue
Block a user