UNPKG

ngx-analytics

Version:

Vendor-agnostic web analytics for Angular2 applications, based on angulartics2

66 lines (60 loc) 2.72 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('ngx-analytics'), require('@uirouter/core'), require('rxjs/Subject')) : typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'ngx-analytics', '@uirouter/core', 'rxjs/Subject'], factory) : (factory((global['ngx-analytics'] = global['ngx-analytics'] || {}, global['ngx-analytics'].uiroutermodule = {}),global.ng.core,global['ngx-analytics'],global['@uirouter/core'],global.Rx)); }(this, (function (exports,core,ngxAnalytics,core$1,Subject) { 'use strict'; var UIRouterTracking = (function () { function UIRouterTracking(transitionService) { this.transitionService = transitionService; } UIRouterTracking.prototype.path = function (trans) { return trans.$to().url.format(trans.params()); }; UIRouterTracking.prototype.trackLocation = function (settings) { var _this = this; var subject = new Subject.Subject(); this.transitionService.onSuccess({}, function (trans) { return subject.next({ url: _this.path(trans) }); }, { priority: -10000, }); return subject; }; UIRouterTracking.prototype.prepareExternalUrl = function (url) { return url; }; UIRouterTracking.decorators = [ { type: core.Injectable }, ]; UIRouterTracking.ctorParameters = function () { return [ { type: core$1.TransitionService, }, ]; }; return UIRouterTracking; }()); var NgxAnalyticsUirouterModule = (function () { function NgxAnalyticsUirouterModule() { } NgxAnalyticsUirouterModule.forRoot = function (providers, settings) { if (settings === void 0) { settings = {}; } return { ngModule: NgxAnalyticsUirouterModule, providers: [ { provide: ngxAnalytics.ANGULARTICS2_TOKEN, useValue: { providers: providers, settings: settings } }, ngxAnalytics.NgxAnalytics, { provide: ngxAnalytics.RouterlessTracking, useClass: UIRouterTracking } ].concat(providers), }; }; NgxAnalyticsUirouterModule.decorators = [ { type: core.NgModule, args: [{ imports: [ngxAnalytics.NgxAnalyticsOnModule], },] }, ]; NgxAnalyticsUirouterModule.ctorParameters = function () { return []; }; return NgxAnalyticsUirouterModule; }()); exports.NgxAnalyticsUirouterModule = NgxAnalyticsUirouterModule; exports.UIRouterTracking = UIRouterTracking; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=uiroutermodule.umd.js.map