Move analytics out of init (#2115)
* Remove listenSessionLoaded from analytics * Move analytics init call to navigation ready * Remove zod dependency from analytics * Mirror changes on the web * Delete listenSessionLoaded * Only set up listeners once
This commit is contained in:
parent
748212e000
commit
6335be14e1
7 changed files with 35 additions and 48 deletions
|
@ -1,6 +1,4 @@
|
|||
import EventEmitter from 'eventemitter3'
|
||||
import {BskyAgent} from '@atproto/api'
|
||||
import {SessionAccount} from './session'
|
||||
|
||||
type UnlistenFn = () => void
|
||||
|
||||
|
@ -16,19 +14,6 @@ export function listenSoftReset(fn: () => void): UnlistenFn {
|
|||
return () => emitter.off('soft-reset', fn)
|
||||
}
|
||||
|
||||
export function emitSessionLoaded(
|
||||
sessionAccount: SessionAccount,
|
||||
agent: BskyAgent,
|
||||
) {
|
||||
emitter.emit('session-loaded', sessionAccount, agent)
|
||||
}
|
||||
export function listenSessionLoaded(
|
||||
fn: (sessionAccount: SessionAccount, agent: BskyAgent) => void,
|
||||
): UnlistenFn {
|
||||
emitter.on('session-loaded', fn)
|
||||
return () => emitter.off('session-loaded', fn)
|
||||
}
|
||||
|
||||
export function emitSessionDropped() {
|
||||
emitter.emit('session-dropped')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue