blob: 61433bb2a8032615c8632e7d99a533598960ca82 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)
}
}
|