@68publishers/cookie-consent
Version:
Cookie consent wrapper based on orestbida/cookieconsent with GTM integration.
31 lines (24 loc) • 622 B
JavaScript
export class StoragePool {
constructor() {
this._items = {};
}
add(storage) {
this._items[storage.name] = storage;
}
has(name) {
return name in this._items;
}
get(name) {
if (!this.has(name)) {
throw new Error(`Missing storage "${name}".`);
}
return this._items[name];
}
all() {
return Object.values(this._items);
}
findVisibleReadonlyDisabled() {
return Object.values(this._items)
.filter(storage => storage.displayInWidget && !storage.enabledByDefault && storage.readonly);
}
}