Skip to content

Commit

Permalink
feat(core): selectively disable icon syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
fynnfeldpausch committed Apr 16, 2024
1 parent 44253a8 commit 9dde03e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/components/cat-icon/cat-icon-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export class CatIconRegistry {
private readonly id = (Math.random() + 1).toString(36).substring(2);
private readonly icons: Map<string, string> = new Map();

// ignore syncing in backwards compatible manner
syncIcons: boolean = true;

private constructor() {
// hide constructor

Expand Down Expand Up @@ -69,13 +72,13 @@ export class CatIconRegistry {
// this registry.
window.addEventListener('cat-icons-added', event => {
const { detail } = (event as CustomEvent) || {};
if (detail && detail.id !== this.id) {
if (this.syncIcons && detail && detail.id !== this.id) {
this.addIcons(detail.icons, detail.setName, true);
}
});
window.addEventListener('cat-icons-removed', event => {
const { detail } = (event as CustomEvent) || {};
if (detail && detail.id !== this.id) {
if (this.syncIcons && detail && detail.id !== this.id) {
this.removeIcons(detail.names, detail.setName, true);
}
});
Expand Down

0 comments on commit 9dde03e

Please sign in to comment.