seitu 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,6 +17,9 @@ export interface Readable<T> {
17
17
  export interface Writable<T, P = T> {
18
18
  set: (value: T | ((prev: P) => T)) => any;
19
19
  }
20
+ export interface Removable {
21
+ remove: () => void;
22
+ }
20
23
  export interface Destroyable {
21
24
  destroy: () => void;
22
25
  }
@@ -1,7 +1,7 @@
1
1
  import type { StandardSchemaV1 } from '@standard-schema/spec';
2
- import type { Destroyable, Readable, Subscribable, Writable } from '../core/index';
2
+ import type { Destroyable, Readable, Removable, Subscribable, Writable } from '../core/index';
3
3
  import type { WebStorage } from './web-storage';
4
- export interface WebStorageValue<V> extends Subscribable<V>, Readable<V>, Writable<V>, Destroyable {
4
+ export interface WebStorageValue<V> extends Subscribable<V>, Readable<V>, Writable<V>, Destroyable, Removable {
5
5
  }
6
6
  export interface WebStorageValueOptionsWithStorage<Storage extends WebStorage<any>, K extends keyof Storage['~']['output']> {
7
7
  storage: Storage;
package/dist/web.js CHANGED
@@ -83,6 +83,9 @@ function a(t) {
83
83
  i = !0, n.setItem(t.key, typeof a == "string" ? a : JSON.stringify(a)), window.dispatchEvent(new Event("storage")), i = !1, c();
84
84
  },
85
85
  subscribe: (e) => s(() => e(l())),
86
+ remove: () => {
87
+ typeof window > "u" || window[r].removeItem(t.key);
88
+ },
86
89
  destroy: () => {
87
90
  typeof window < "u" && window.removeEventListener("storage", u);
88
91
  },
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "seitu",
3
3
  "displayName": "Seitu",
4
4
  "type": "module",
5
- "version": "0.4.6",
5
+ "version": "0.4.7",
6
6
  "private": false,
7
7
  "author": "Valerii Strilets",
8
8
  "license": "MIT",