forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tracking.d.ts
40 lines (32 loc) · 986 Bytes
/
tracking.d.ts
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
// Type definitions for Tracking.js v1.1.2
// Project: https://github.com/eduardolundgren/tracking.js
// Definitions by: Tim Perry <https://github.com/pimterry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace tracking {
export class ColorTracker extends Tracker {
constructor(colours: string[]);
static registerColor(name: string, predicate: (r: number, g: number, b: number) => boolean): void;
}
export class ObjectTracker extends Tracker {
constructor(objects: string[]);
}
class Tracker {
constructor(target: string);
on(eventName: string, callback: (event: TrackEvent) => void): void;
}
interface TrackEvent {
data: TrackRect[];
}
interface TrackRect {
x: number;
y: number;
height: number;
width: number;
color: string;
}
interface TrackerTask {
stop(): void;
run(): void;
}
export function track(selector: string, tracker: tracking.Tracker): TrackerTask;
}