UNPKG

1.23 kBJavaScriptView Raw
1"use strict";
2/**
3 * @hidden
4 */
5var Core = (function () {
6 function Core(deps) {
7 /**
8 * @private
9 */
10 this._version = '0.8.1';
11 this.config = deps.config;
12 this.logger = deps.logger;
13 this.emitter = deps.emitter;
14 this.insights = deps.insights;
15 }
16 Core.prototype.init = function () {
17 this.registerEventHandlers();
18 this.onResume();
19 };
20 Object.defineProperty(Core.prototype, "version", {
21 get: function () {
22 return this._version;
23 },
24 enumerable: true,
25 configurable: true
26 });
27 /**
28 * @private
29 */
30 Core.prototype.onResume = function () {
31 this.insights.track('mobileapp.opened');
32 };
33 /**
34 * @private
35 */
36 Core.prototype.registerEventHandlers = function () {
37 var _this = this;
38 this.emitter.on('cordova:resume', function () {
39 _this.onResume();
40 });
41 this.emitter.on('push:notification', function (data) {
42 if (data.message.app.asleep || data.message.app.closed) {
43 _this.insights.track('mobileapp.opened.push');
44 }
45 });
46 };
47 return Core;
48}());
49exports.Core = Core;