How to use the @iconify/iconify.preloadImages function in @iconify/iconify

To help you get started, we’ve selected a few @iconify/iconify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iconify / iconify-figma / ui / src / components / iconify / footer / footer.jsx View on Github external
render() {
		let app = this.props.app,
			iconName = app.options.iconName;

		// No icon selected - render SimpleFooter
		if (iconName === null) {
			return ;
		}

		// Check if icon has been loaded
		if (!Iconify.iconExists(iconName)) {
			Iconify.preloadImages([iconName]);
			if (!this._listener) {
				this._listener = this._onIconsLoaded.bind(this);
				document.addEventListener('IconifyAddedIcons', this._listener, true);
			}
			return ;
		}

		// Loaded
		return ;
	}
github iconify / iconify-figma / ui / src / components / iconify / blocks / icons.jsx View on Github external
block = props.view.blocks[name],
			options = props.app.options,
			list = options.list,
			selectedIcon = options.iconName,
			Component = list ? LongIcon : Icon;

		if (!block || block.empty()) {
			return null;
		}

		// Pre-load all icons
		let missing = block.icons.filter(
			icon => !Iconify.iconExists(icon.prefix + ':' + icon.name)
		);
		if (missing.length) {
			Iconify.preloadImages(missing.map(icon => icon.prefix + ':' + icon.name));
		}

		// Render all icons
		let icons = [];
		block.icons.forEach(icon => {
			let key = icon.prefix + ':' + icon.name;

			// Icon name
			let title = key;
			if (props.view.type === 'collection') {
				// Do not show prefix when viewing collection
				title = icon.name;
			}

			icons.push(

@iconify/iconify

Unified SVG framework with over 100,000 icons to choose from

MIT
Latest version published 2 years ago

Package Health Score

61 / 100
Full package analysis

Similar packages