iconly
Version:
Iconly is designed to load and cache SVG icons in the browser, using IndexedDB to store the data. It retrieves the icons from a given SVG file, stores them in IndexedDB, and inserts them into the DOM for easy access and use.
46 lines (32 loc) • 1.14 kB
Markdown
All notable changes to this project will be documented in this file.
- **API changed**: `new Iconly()` was replaced by `createIconly()`.
- **Init contract changed**: `init()` no longer throws and no longer returns `void`. It now returns a `Result<void>` that must be checked via `result.ok`.
- **DOM anchor changed**: the injected sprite wrapper is now a `<div data-iconly="iconset" aria-hidden="true">...</div>` inside the configured `container` (previously `id="iconset"`).
- **Storage is configurable**: caching can use `'indexeddb' | 'memory' | 'session'` or a custom storage implementation.
Before:
```js
import Iconly from 'iconly';
const iconly = new Iconly({ file: './sprite.svg' });
await iconly.init();
```
After:
```js
import { createIconly } from 'iconly';
const iconly = createIconly({ file: './sprite.svg' });
const result = await iconly.init();
if (!result.ok) console.error(result.error);
```
Before:
```html
```
After (created inside `container`):
```html
[]
```