2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-09 23:00:56 +00:00

Group up exposed internal functions in SVG framework

This commit is contained in:
Vjacheslav Trushkin 2020-06-04 16:45:29 +03:00
parent 4fc2a3727b
commit 6c461f3b92

View File

@ -64,7 +64,6 @@ import { renderIcon } from './render';
// Scan
import { scanDOM } from './scan';
import { Redundancy } from '@iconify/core/node_modules/@cyberalien/redundancy';
/**
* Export required types
@ -96,6 +95,20 @@ export {
*/
export type IconifyCacheType = 'local' | 'session' | 'all';
/**
* Exposed internal functions
*
* Used by plug-ins, such as Icon Finder
*
* Important: any changes published in a release must be backwards compatible.
*/
export interface IconifyExposedInternals {
/**
* Get internal API data, used by Icon Finder
*/
getAPI: (provider: string) => IconifyAPIInternalStorage | undefined;
}
/**
* Iconify interface
*/
@ -193,13 +206,6 @@ export interface IconifyGlobal {
customConfig: Partial<IconifyAPIConfig>
) => void;
/**
* Get internal API data, used by Icon Finder
*/
_getInternalAPI: (
provider: string
) => IconifyAPIInternalStorage | undefined;
/* Scan DOM */
/**
* Scan DOM
@ -215,6 +221,11 @@ export interface IconifyGlobal {
* Toggle local and session storage
*/
enableCache: (storage: IconifyCacheType, value: boolean) => void;
/**
* Expose internal functions
*/
_internal: IconifyExposedInternals;
}
/**
@ -410,9 +421,6 @@ const Iconify: IconifyGlobal = {
// API providers
addAPIProvider: setAPIConfig,
// Get API data
_getInternalAPI: getRedundancyCache,
// Scan DOM
scanDOM: scanDOM,
@ -442,6 +450,12 @@ const Iconify: IconifyGlobal = {
break;
}
},
// Exposed internal functions
_internal: {
// Get API data
getAPI: getRedundancyCache,
},
};
/**