UNPKG

1.3 kBTypeScriptView Raw
1import { IInsights, IStatSerialized, InsightsDependencies, InsightsOptions } from './definitions';
2/**
3 * @hidden
4 */
5export declare class Stat {
6 appId: string;
7 stat: string;
8 value: number;
9 created: Date;
10 constructor(appId: string, stat: string, value?: number);
11 toJSON(): IStatSerialized;
12}
13/**
14 * A client for Insights that handles batching, user activity insight, and
15 * sending insights at an interval.
16 *
17 * @hidden
18 */
19export declare class Insights implements IInsights {
20 options: InsightsOptions;
21 /**
22 * @private
23 */
24 private app;
25 /**
26 * @private
27 */
28 private storage;
29 /**
30 * @private
31 */
32 private config;
33 /**
34 * @private
35 */
36 private client;
37 /**
38 * @private
39 */
40 private logger;
41 /**
42 * @private
43 */
44 private batch;
45 constructor(deps: InsightsDependencies, options?: InsightsOptions);
46 /**
47 * Track an insight.
48 *
49 * @param stat - The insight name.
50 * @param value - The number by which to increment this insight.
51 */
52 track(stat: string, value?: number): void;
53 protected checkActivity(): void;
54 protected markActive(): void;
55 protected trackStat(stat: Stat): void;
56 protected shouldSubmit(): boolean;
57 protected submit(): void;
58}