serverless-spy
Version:
CDK-based library for writing elegant integration tests on AWS serverless architecture and an additional web console to monitor events in real time.
13 lines (12 loc) • 420 B
JavaScript
import { IndexedDbStorage } from "./IndexedDbStorage";
import { InMemoryStorage } from "./InMemoryStorage";
const inMemoryStorage = new InMemoryStorage();
export function localStorage() {
if (typeof self === "object" && self.indexedDB) {
return new IndexedDbStorage();
}
if (typeof window === "object" && window.localStorage) {
return window.localStorage;
}
return inMemoryStorage;
}