@aller/blink-labrador
Advanced tools
Comparing version 0.6.3 to 0.6.4
@@ -89,4 +89,2 @@ 'use strict'; | ||
var _configureSender2 = _interopRequireDefault(_configureSender); | ||
var _articlePreview = require('./utils/article-preview'); | ||
@@ -118,8 +116,4 @@ | ||
(0, _configureSender2.default)({ | ||
sendInterval: 10000, | ||
batchLimit: 3, | ||
batchInterval: 3000, | ||
sendUrl: 'https://aas.medialaben.no/a/' | ||
}); | ||
var senderConfigurationParameters = (0, _configureSender.getSenderConfigurationParameters)(); | ||
(0, _configureSender.configureSender)(senderConfigurationParameters); | ||
this.pageView = (0, _uuid2.default)('pageView'); | ||
@@ -126,0 +120,0 @@ this.activeTimeTimerId = 0; |
@@ -6,4 +6,9 @@ 'use strict'; | ||
}); | ||
exports.default = configureSender; | ||
exports.configureSender = configureSender; | ||
exports.getSenderConfigurationParameters = getSenderConfigurationParameters; | ||
var _includes = require('lodash/includes'); | ||
var _includes2 = _interopRequireDefault(_includes); | ||
var _visibilitychange = require('../triggers/visibilitychange'); | ||
@@ -56,7 +61,9 @@ | ||
// Configure batching | ||
setInterval(function () { | ||
if (_sender2.default.pendingEvents.length > batchLimit) { | ||
_sender2.default.sendAllNow('BATCH'); | ||
} | ||
}, batchInterval); | ||
if (batchInterval) { | ||
setInterval(function () { | ||
if (_sender2.default.pendingEvents.length > batchLimit) { | ||
_sender2.default.sendAllNow('BATCH'); | ||
} | ||
}, batchInterval); | ||
} | ||
@@ -86,2 +93,21 @@ // Configure normal send interval | ||
}); | ||
} | ||
function getSenderConfigurationParameters() { | ||
var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : navigator.userAgent; | ||
if ((0, _includes2.default)(userAgent, '_app_')) { | ||
return { | ||
sendInterval: 2000, | ||
batchLimit: 0, | ||
batchInterval: 0, | ||
sendUrl: 'https://aas.medialaben.no/a/' | ||
}; | ||
} | ||
return { | ||
sendInterval: 10000, | ||
batchLimit: 3, | ||
batchInterval: 3000, | ||
sendUrl: 'https://aas.medialaben.no/a/' | ||
}; | ||
} |
{ | ||
"name": "@aller/blink-labrador", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"description": "Library for using blink on Labrador", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.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
46539
1159