-
Notifications
You must be signed in to change notification settings - Fork 0
/
inline-service.ts
77 lines (68 loc) · 1.79 KB
/
inline-service.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
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
71
72
73
74
75
76
77
import { Injectable } from "@angular/core";
import { WindowRefService } from "./window-ref.service";
import { InlineManualTracking } from "./interfaces";
@Injectable()
export class InlineService {
_window: any;
constructor(windowRef: WindowRefService) {
this._window = windowRef.nativeWindow;
}
setTracking(trackingData: InlineManualTracking) {
this._window.inlineManualTracking = trackingData;
}
createPlayer() {
const trackingData = this._window.inlineManualPlayerData || null;
try {
this._window.createInlineManualPlayer(trackingData);
} catch (error) {
console.error(error);
}
}
updatePlayer() {
if (!this._window.inline_manual_player) { return; }
try {
this._window.inline_manual_player.update();
} catch (error) {
console.error(error);
}
}
activateTopic(id: string) {
try {
this._window.inline_manual_player.activateTopic(id);
} catch (error) {
console.error(error);
}
}
showPanel() {
try {
this._window.inline_manual_player.showPanel();
} catch (error) {
console.error(error);
}
}
// incomplete examples
// goToStep() {
// this._window.inline_manual_player.goToStep();
// }
// deactivate() {
// this._window.inline_manual_player.deactivate();
// }
// getCurrentTopic() {
// this._window.inline_manual_player.getCurrentTopic();
// }
// getCurrentStep() {
// this._window.inline_manual_player.getCurrentStep();
// }
// setMetadata() {
// this._window.inline_manual_player.setMetadata();
// }
// hidePanel() {
// this._window.inline_manual_player.hidePanel();
// }
// togglePanel() {
// this._window.inline_manual_player.togglePanel();
// }
// destroy() {
// this._window.inline_manual_player.destroy();
// }
}