mirror of
https://github.com/iconify/iconify.git
synced 2025-01-06 07:20:40 +00:00
Clean up code for IconifyPreload and IconifyProviders
This commit is contained in:
parent
3f6265fdac
commit
7214c077b4
@ -211,18 +211,14 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
||||
// addFinder(iconifyIconFinder);
|
||||
addFinder(iconifyFinder);
|
||||
|
||||
const _window = window;
|
||||
interface WindowWithIconifyStuff {
|
||||
IconifyPreload?: IconifyJSON[] | IconifyJSON;
|
||||
}
|
||||
const _window = window as WindowWithIconifyStuff;
|
||||
|
||||
// Load icons from global "IconifyPreload"
|
||||
interface WindowWithIconifyPreload {
|
||||
IconifyPreload: IconifyJSON[] | IconifyJSON;
|
||||
}
|
||||
if (
|
||||
(_window as unknown as WindowWithIconifyPreload).IconifyPreload !==
|
||||
void 0
|
||||
) {
|
||||
const preload = (_window as unknown as WindowWithIconifyPreload)
|
||||
.IconifyPreload;
|
||||
if (_window.IconifyPreload !== void 0) {
|
||||
const preload = _window.IconifyPreload;
|
||||
const err = 'Invalid IconifyPreload syntax.';
|
||||
if (typeof preload === 'object' && preload !== null) {
|
||||
(preload instanceof Array ? preload : [preload]).forEach((item) => {
|
||||
|
@ -130,10 +130,10 @@ const browserCacheFunctions: IconifyBrowserCacheFunctions = {
|
||||
/**
|
||||
* Global variable
|
||||
*/
|
||||
const Iconify = ({
|
||||
const Iconify = {
|
||||
// Exposed internal API functions
|
||||
_api: APIInternalFunctions,
|
||||
} as unknown) as IconifyGlobal;
|
||||
} as unknown as IconifyGlobal;
|
||||
|
||||
// Add functions
|
||||
[
|
||||
@ -188,18 +188,14 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
||||
coreModules.cache = storeCache;
|
||||
loadCache();
|
||||
|
||||
const _window = window;
|
||||
interface WindowWithIconifyStuff {
|
||||
IconifyProviders?: Record<string, PartialIconifyAPIConfig>;
|
||||
}
|
||||
const _window = window as WindowWithIconifyStuff;
|
||||
|
||||
// Set API from global "IconifyProviders"
|
||||
interface WindowWithIconifyProviders {
|
||||
IconifyProviders: Record<string, PartialIconifyAPIConfig>;
|
||||
}
|
||||
if (
|
||||
((_window as unknown) as WindowWithIconifyProviders)
|
||||
.IconifyProviders !== void 0
|
||||
) {
|
||||
const providers = ((_window as unknown) as WindowWithIconifyProviders)
|
||||
.IconifyProviders;
|
||||
if (_window.IconifyProviders !== void 0) {
|
||||
const providers = _window.IconifyProviders;
|
||||
if (typeof providers === 'object' && providers !== null) {
|
||||
for (let key in providers) {
|
||||
const err = 'IconifyProviders[' + key + '] is invalid.';
|
||||
|
@ -233,18 +233,15 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
||||
coreModules.cache = storeCache;
|
||||
loadCache();
|
||||
|
||||
const _window = window;
|
||||
interface WindowWithIconifyStuff {
|
||||
IconifyPreload?: IconifyJSON[] | IconifyJSON;
|
||||
IconifyProviders?: Record<string, PartialIconifyAPIConfig>;
|
||||
}
|
||||
const _window = window as WindowWithIconifyStuff;
|
||||
|
||||
// Load icons from global "IconifyPreload"
|
||||
interface WindowWithIconifyPreload {
|
||||
IconifyPreload: IconifyJSON[] | IconifyJSON;
|
||||
}
|
||||
if (
|
||||
(_window as unknown as WindowWithIconifyPreload).IconifyPreload !==
|
||||
void 0
|
||||
) {
|
||||
const preload = (_window as unknown as WindowWithIconifyPreload)
|
||||
.IconifyPreload;
|
||||
if (_window.IconifyPreload !== void 0) {
|
||||
const preload = _window.IconifyPreload;
|
||||
const err = 'Invalid IconifyPreload syntax.';
|
||||
if (typeof preload === 'object' && preload !== null) {
|
||||
(preload instanceof Array ? preload : [preload]).forEach((item) => {
|
||||
@ -270,15 +267,8 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
||||
}
|
||||
|
||||
// Set API from global "IconifyProviders"
|
||||
interface WindowWithIconifyProviders {
|
||||
IconifyProviders: Record<string, PartialIconifyAPIConfig>;
|
||||
}
|
||||
if (
|
||||
(_window as unknown as WindowWithIconifyProviders).IconifyProviders !==
|
||||
void 0
|
||||
) {
|
||||
const providers = (_window as unknown as WindowWithIconifyProviders)
|
||||
.IconifyProviders;
|
||||
if (_window.IconifyProviders !== void 0) {
|
||||
const providers = _window.IconifyProviders;
|
||||
if (typeof providers === 'object' && providers !== null) {
|
||||
for (let key in providers) {
|
||||
const err = 'IconifyProviders[' + key + '] is invalid.';
|
||||
|
@ -229,18 +229,15 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
||||
coreModules.cache = storeCache;
|
||||
loadCache();
|
||||
|
||||
const _window = window;
|
||||
interface WindowWithIconifyStuff {
|
||||
IconifyPreload?: IconifyJSON[] | IconifyJSON;
|
||||
IconifyProviders?: Record<string, PartialIconifyAPIConfig>;
|
||||
}
|
||||
const _window = window as WindowWithIconifyStuff;
|
||||
|
||||
// Load icons from global "IconifyPreload"
|
||||
interface WindowWithIconifyPreload {
|
||||
IconifyPreload: IconifyJSON[] | IconifyJSON;
|
||||
}
|
||||
if (
|
||||
(_window as unknown as WindowWithIconifyPreload).IconifyPreload !==
|
||||
void 0
|
||||
) {
|
||||
const preload = (_window as unknown as WindowWithIconifyPreload)
|
||||
.IconifyPreload;
|
||||
if (_window.IconifyPreload !== void 0) {
|
||||
const preload = _window.IconifyPreload;
|
||||
const err = 'Invalid IconifyPreload syntax.';
|
||||
if (typeof preload === 'object' && preload !== null) {
|
||||
(preload instanceof Array ? preload : [preload]).forEach((item) => {
|
||||
@ -266,15 +263,8 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
||||
}
|
||||
|
||||
// Set API from global "IconifyProviders"
|
||||
interface WindowWithIconifyProviders {
|
||||
IconifyProviders: Record<string, PartialIconifyAPIConfig>;
|
||||
}
|
||||
if (
|
||||
(_window as unknown as WindowWithIconifyProviders).IconifyProviders !==
|
||||
void 0
|
||||
) {
|
||||
const providers = (_window as unknown as WindowWithIconifyProviders)
|
||||
.IconifyProviders;
|
||||
if (_window.IconifyProviders !== void 0) {
|
||||
const providers = _window.IconifyProviders;
|
||||
if (typeof providers === 'object' && providers !== null) {
|
||||
for (let key in providers) {
|
||||
const err = 'IconifyProviders[' + key + '] is invalid.';
|
||||
|
@ -241,18 +241,15 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
||||
coreModules.cache = storeCache;
|
||||
loadCache();
|
||||
|
||||
const _window = window;
|
||||
interface WindowWithIconifyStuff {
|
||||
IconifyPreload?: IconifyJSON[] | IconifyJSON;
|
||||
IconifyProviders?: Record<string, PartialIconifyAPIConfig>;
|
||||
}
|
||||
const _window = window as WindowWithIconifyStuff;
|
||||
|
||||
// Load icons from global "IconifyPreload"
|
||||
interface WindowWithIconifyPreload {
|
||||
IconifyPreload: IconifyJSON[] | IconifyJSON;
|
||||
}
|
||||
if (
|
||||
((_window as unknown) as WindowWithIconifyPreload).IconifyPreload !==
|
||||
void 0
|
||||
) {
|
||||
const preload = ((_window as unknown) as WindowWithIconifyPreload)
|
||||
.IconifyPreload;
|
||||
if (_window.IconifyPreload !== void 0) {
|
||||
const preload = _window.IconifyPreload;
|
||||
const err = 'Invalid IconifyPreload syntax.';
|
||||
if (typeof preload === 'object' && preload !== null) {
|
||||
(preload instanceof Array ? preload : [preload]).forEach(item => {
|
||||
@ -278,15 +275,8 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
||||
}
|
||||
|
||||
// Set API from global "IconifyProviders"
|
||||
interface WindowWithIconifyProviders {
|
||||
IconifyProviders: Record<string, PartialIconifyAPIConfig>;
|
||||
}
|
||||
if (
|
||||
((_window as unknown) as WindowWithIconifyProviders)
|
||||
.IconifyProviders !== void 0
|
||||
) {
|
||||
const providers = ((_window as unknown) as WindowWithIconifyProviders)
|
||||
.IconifyProviders;
|
||||
if (_window.IconifyProviders !== void 0) {
|
||||
const providers = _window.IconifyProviders;
|
||||
if (typeof providers === 'object' && providers !== null) {
|
||||
for (let key in providers) {
|
||||
const err = 'IconifyProviders[' + key + '] is invalid.';
|
||||
|
@ -233,18 +233,15 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
||||
coreModules.cache = storeCache;
|
||||
loadCache();
|
||||
|
||||
const _window = window;
|
||||
interface WindowWithIconifyStuff {
|
||||
IconifyPreload?: IconifyJSON[] | IconifyJSON;
|
||||
IconifyProviders?: Record<string, PartialIconifyAPIConfig>;
|
||||
}
|
||||
const _window = window as WindowWithIconifyStuff;
|
||||
|
||||
// Load icons from global "IconifyPreload"
|
||||
interface WindowWithIconifyPreload {
|
||||
IconifyPreload: IconifyJSON[] | IconifyJSON;
|
||||
}
|
||||
if (
|
||||
(_window as unknown as WindowWithIconifyPreload).IconifyPreload !==
|
||||
void 0
|
||||
) {
|
||||
const preload = (_window as unknown as WindowWithIconifyPreload)
|
||||
.IconifyPreload;
|
||||
if (_window.IconifyPreload !== void 0) {
|
||||
const preload = _window.IconifyPreload;
|
||||
const err = 'Invalid IconifyPreload syntax.';
|
||||
if (typeof preload === 'object' && preload !== null) {
|
||||
(preload instanceof Array ? preload : [preload]).forEach((item) => {
|
||||
@ -270,15 +267,8 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
||||
}
|
||||
|
||||
// Set API from global "IconifyProviders"
|
||||
interface WindowWithIconifyProviders {
|
||||
IconifyProviders: Record<string, PartialIconifyAPIConfig>;
|
||||
}
|
||||
if (
|
||||
(_window as unknown as WindowWithIconifyProviders).IconifyProviders !==
|
||||
void 0
|
||||
) {
|
||||
const providers = (_window as unknown as WindowWithIconifyProviders)
|
||||
.IconifyProviders;
|
||||
if (_window.IconifyProviders !== void 0) {
|
||||
const providers = _window.IconifyProviders;
|
||||
if (typeof providers === 'object' && providers !== null) {
|
||||
for (let key in providers) {
|
||||
const err = 'IconifyProviders[' + key + '] is invalid.';
|
||||
|
Loading…
Reference in New Issue
Block a user