diff options
Diffstat (limited to 'src/state/geolocation/events.ts')
-rw-r--r-- | src/state/geolocation/events.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/state/geolocation/events.ts b/src/state/geolocation/events.ts new file mode 100644 index 000000000..61433bb2a --- /dev/null +++ b/src/state/geolocation/events.ts @@ -0,0 +1,19 @@ +import EventEmitter from 'eventemitter3' + +import {type Device} from '#/storage' + +const events = new EventEmitter() +const EVENT = 'geolocation-config-updated' + +export const emitGeolocationConfigUpdate = (config: Device['geolocation']) => { + events.emit(EVENT, config) +} + +export const onGeolocationConfigUpdate = ( + listener: (config: Device['geolocation']) => void, +) => { + events.on(EVENT, listener) + return () => { + events.off(EVENT, listener) + } +} |