UNPKG

1.47 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 device;
41 /**
42 * @private
43 */
44 private logger;
45 /**
46 * @private
47 */
48 private batch;
49 constructor(deps: InsightsDependencies, options?: InsightsOptions);
50 /**
51 * Track an insight.
52 *
53 * @param stat - The insight name.
54 * @param value - The number by which to increment this insight.
55 */
56 track(stat: string, value?: number): void;
57 protected checkActivity(): void;
58 protected markActive(): void;
59 protected normalizeDevicePlatform(platform: string): string;
60 protected normalizeVersion(s: string): string;
61 protected trackStat(stat: Stat): void;
62 protected shouldSubmit(): boolean;
63 protected submit(): void;
64}