export interface LocalStorageEventPayload { key: string; value: TValue; } /** * Used for creating new events for LocalStorage. This enables us to * have the ability of updating the LocalStorage from outside of the component, * but still update the component without prop drilling or creating a dependency * on a large library such as Redux. */ export declare class LocalStorageChanged extends CustomEvent> { static eventName: string; constructor(payload: LocalStorageEventPayload); } /** * Checks if the event that is passed in is the same type as LocalStorageChanged. * * @export * @template TValue * @param {*} evt the object you wish to assert as a LocalStorageChanged event. * @returns {evt is LocalStorageChanged} if true, evt is asserted to be LocalStorageChanged. */ export declare function isTypeOfLocalStorageChanged(evt: any): evt is LocalStorageChanged; /** * Use this instead of directly using localStorage.setItem * in order to correctly send events within the same window. * * @example * ```js * writeStorage('hello', JSON.stringify({ name: 'world' })); * const { name } = JSON.parse(localStorage.getItem('hello')); * ``` * * @export * @param {string} key The key to write to in the localStorage. * @param {string} value The value to write to in the localStorage. */ export declare function writeStorage(key: string, value: TValue): void; /** * Use this function to delete a value from localStorage. * * After calling this function, the localStorage value will be null. * * @example * ```js * const user = { name: 'John', email: 'John@fakemail.com' }; * * // Add a user to your localStorage * writeStorage('user', JSON.stringify(user)); * * // This will also trigger an update to the state of your component * deleteFromStorage('user'); * * localStorage.getItem('user') === null // ✔ This is now null * ``` * * @export * @param {string} key The key of the item you wish to delete from localStorage. */ export declare function deleteFromStorage(key: string): void; //# sourceMappingURL=local-storage-events.d.ts.map