diff options
Diffstat (limited to 'src/state/models/root-store.ts')
-rw-r--r-- | src/state/models/root-store.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/state/models/root-store.ts b/src/state/models/root-store.ts index 5646157cb..73f1c452f 100644 --- a/src/state/models/root-store.ts +++ b/src/state/models/root-store.ts @@ -5,6 +5,7 @@ import {makeAutoObservable} from 'mobx' import {sessionClient as AtpApi, SessionServiceClient} from '@atproto/api' import {createContext, useContext} from 'react' +import {DeviceEventEmitter, EmitterSubscription} from 'react-native' import {isObj, hasProp} from '../lib/type-guards' import {LogModel} from './log' import {SessionModel} from './session' @@ -102,6 +103,15 @@ export class RootStoreModel { this.nav.clear() this.me.clear() } + + onPostDeleted(handler: (uri: string) => void): EmitterSubscription { + return DeviceEventEmitter.addListener('post-deleted', handler) + } + + emitPostDeleted(uri: string) { + console.log('emit') + DeviceEventEmitter.emit('post-deleted', uri) + } } const throwawayInst = new RootStoreModel(AtpApi.service('http://localhost')) // this will be replaced by the loader, we just need to supply a value at init |