| 4 | import { draftStorageKey } from '../src/lib/storage'; |
| 5 | |
| 6 | function memoryStorage(): Storage { |
| 7 | const map = new Map<string, string>(); |
| 8 | return { |
| 9 | get length() { |
| 10 | return map.size; |
| 11 | }, |
| 12 | clear: () => { |
| 13 | map.clear(); |
| 14 | }, |
| 15 | getItem: (key: string) => map.get(key) ?? null, |
| 16 | key: (index: number) => Array.from(map.keys())[index] ?? null, |
| 17 | removeItem: (key: string) => { |
| 18 | map.delete(key); |
| 19 | }, |
| 20 | setItem: (key: string, value: string) => { |
| 21 | map.set(key, value); |
| 22 | }, |
| 23 | }; |
| 24 | } |
| 25 | |
| 26 | function setup(initialSid: string | undefined) { |
| 27 | const sid = ref(initialSid); |