Ronald 9d21736e9f
Add UI copyright headers files (#16614)
* Add copyright headers to UI files

* Ensure copywrite file ignores external libs
2023-03-14 09:18:55 -04:00

30 lines
560 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { TrackedArray } from 'tracked-built-ins';
import Storage from './base';
export default class Notices extends Storage {
initState() {
const { key, storage } = this;
const persisted = storage.getItem(key);
if (persisted) {
return new TrackedArray(persisted.split(','));
} else {
return new TrackedArray();
}
}
add(value) {
const { key, storage, state } = this;
state.push(value);
storage.setItem(key, [...state]);
}
}