import {UPDATE_STORAGE_EVENT} from "../../constants/events";

export type actionType = (data: {key: string, value: any}) => void

export const storageListener = (action: actionType) => {
    window.addEventListener(UPDATE_STORAGE_EVENT, (e:any) => {
        action({
            key: e?.detail?.keyEvent,
            value: e?.detail?.value
        })
    })
}