blob: 3a6918c09dfedab78dbd5ab9ebce5e35a92cfd9a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
import { BeaconInfoState, BeaconLocationState } from "../content-helpers";
import { MatrixEvent } from "./event";
import { TypedEventEmitter } from "./typed-event-emitter";
export declare enum BeaconEvent {
New = "Beacon.new",
Update = "Beacon.update",
LivenessChange = "Beacon.LivenessChange",
Destroy = "Beacon.Destroy",
LocationUpdate = "Beacon.LocationUpdate"
}
export type BeaconEventHandlerMap = {
[BeaconEvent.Update]: (event: MatrixEvent, beacon: Beacon) => void;
[BeaconEvent.LivenessChange]: (isLive: boolean, beacon: Beacon) => void;
[BeaconEvent.Destroy]: (beaconIdentifier: string) => void;
[BeaconEvent.LocationUpdate]: (locationState: BeaconLocationState) => void;
[BeaconEvent.Destroy]: (beaconIdentifier: string) => void;
};
export declare const isTimestampInDuration: (startTimestamp: number, durationMs: number, timestamp: number) => boolean;
export type BeaconIdentifier = string;
export declare const getBeaconInfoIdentifier: (event: MatrixEvent) => BeaconIdentifier;
export declare class Beacon extends TypedEventEmitter<Exclude<BeaconEvent, BeaconEvent.New>, BeaconEventHandlerMap> {
private rootEvent;
readonly roomId: string;
private _beaconInfo;
private _isLive?;
private livenessWatchTimeout?;
private _latestLocationEvent?;
constructor(rootEvent: MatrixEvent);
get isLive(): boolean;
get identifier(): BeaconIdentifier;
get beaconInfoId(): string;
get beaconInfoOwner(): string;
get beaconInfoEventType(): string;
get beaconInfo(): BeaconInfoState;
get latestLocationState(): BeaconLocationState | undefined;
get latestLocationEvent(): MatrixEvent | undefined;
update(beaconInfoEvent: MatrixEvent): void;
destroy(): void;
/**
* Monitor liveness of a beacon
* Emits BeaconEvent.LivenessChange when beacon expires
*/
monitorLiveness(): void;
/**
* Process Beacon locations
* Emits BeaconEvent.LocationUpdate
*/
addLocations(beaconLocationEvents: MatrixEvent[]): void;
private clearLatestLocation;
private setBeaconInfo;
private checkLiveness;
}
//# sourceMappingURL=beacon.d.ts.map
|