@waves/event-sender
Advanced tools
Comparing version 0.5.0-a2 to 0.5.0-a3
@@ -19,2 +19,3 @@ /// <reference path="../interface.d.ts" /> | ||
private static entries; | ||
private static asyncForEach; | ||
private static instance; | ||
@@ -21,0 +22,0 @@ } |
@@ -49,4 +49,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.analytics = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
_this.apiList = []; | ||
_this.events.forEach(function (event) { | ||
bus.dispatchEvent('event', event); | ||
Analytics.asyncForEach(_this.events, function (event) { | ||
bus.dispatchEvent('event', __assign({}, event, { params: __assign({}, event.params || {}, _this.defaultParams) })); | ||
}); | ||
@@ -66,8 +66,7 @@ _this.events = []; | ||
Analytics.prototype.send = function (data) { | ||
var message = __assign({}, data, { params: __assign({}, data.params || {}, this.defaultParams) }); | ||
if (this.isActive && this.createBusPromise) { | ||
this.createBusPromise.then(Analytics.dispatch('event', message)); | ||
this.createBusPromise.then(Analytics.dispatch('event', __assign({}, data, { params: __assign({}, data.params || {}, this.defaultParams) }))); | ||
} | ||
else { | ||
this.events.push(message); | ||
this.events.push(data); | ||
} | ||
@@ -106,2 +105,13 @@ }; | ||
}; | ||
Analytics.asyncForEach = function (list, cb) { | ||
var clone = list.slice().reverse(); | ||
var loop = function (item) { | ||
if (!item) { | ||
return void 0; | ||
} | ||
cb(item); | ||
setTimeout(function () { return loop(clone.pop()); }, 100); | ||
}; | ||
loop(clone.pop()); | ||
}; | ||
return Analytics; | ||
@@ -108,0 +118,0 @@ }()); |
{ | ||
"name": "@waves/event-sender", | ||
"version": "0.5.0-a2", | ||
"version": "0.5.0-a3", | ||
"description": "An interface for sending analytics events from Waves JS applications", | ||
@@ -5,0 +5,0 @@ "main": "dist/analytics.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31599
226