/
marker.js
70 lines (61 loc) · 1.54 KB
/
marker.js
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import EventEmitter from 'event-emitter'
/*
* This represents and Marker and should be extended.
*/
export default class Marker {
constructor() {
this._emitter = new EventEmitter({})
}
/*
* Get the event emitter.
* Used by the plugin and notifyTooltipChanged() method
*/
getEmitter() {
return this._emitter
}
/*
* Call this to notify the plugin that the time of the marker
* has changed so that it's position can be recalculated and changed
* if necessary.
*/
notifyTimeChanged() {
this._emitter.emit("timeChanged")
}
/*
* Call this to notify the plugin that the contents of the tooltip
* has changed so that it's position will be recalculated and changed
* if necessary.
*/
notifyTooltipChanged() {
this._emitter.emit("tooltipChanged")
}
/*
* Should return the time (in seconds) that this marker represents.
*/
getTime() {
throw "Not implemented!"
}
/*
* Should return the dom element which should represent the marker.
* It will be inserted onto the seek bar and kept at the correct location.
*/
getMarkerEl() {
throw "Not implemented!"
}
/*
* Should return the dom element which is the tool tip,
* or null if there is no tool tip for this marker.
*
* The tooltip will placed above the marker element, inside a container,
* and this containers position will be managed for you.
*/
getTooltipEl() {
throw "Not implemented!"
}
/*
* Called when the marker is removed.
*/
onDestroy() {
// default to doing nothing
}
}