UNPKG

@scandit/web-datacapture-core

Version:

Scandit Data Capture SDK for the Web

1 lines 716 B
var r=class e{constructor(){this.translations=new Map;this.subscribers=new Set;}static getInstance(){return e.instance==null&&(e.instance=new e),e.instance}get(t){var i;return (i=this.translations.get(t))!=null?i:""}getAll(){return Object.fromEntries(this.translations.entries())}update(t){this.translations=new Map(Object.entries({...Object.fromEntries(this.translations),...t}));let i=this.getAll();for(let s of this.subscribers)s(i);}updateIfMissing(t){for(let[s,n]of Object.entries(t))this.translations.has(s)||this.translations.set(s,n);let i=this.getAll();for(let s of this.subscribers)s(i);}subscribe(t){return this.subscribers.add(t),t(this.getAll()),{cancel:()=>this.subscribers.delete(t)}}};export{r as a};