Skip to content

Commit 828131d

Browse files
Make settings.impressionListener configurable dinamically
1 parent 63a6460 commit 828131d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio-commons",
3-
"version": "2.4.2-rc.0",
3+
"version": "2.4.2-rc.1",
44
"description": "Split JavaScript SDK common components",
55
"main": "cjs/index.js",
66
"module": "esm/index.js",

src/trackers/impressionsTracker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function impressionsTrackerFactory(
2020
telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync,
2121
): IImpressionsTracker {
2222

23-
const { log, impressionListener, runtime: { ip, hostname }, version } = settings;
23+
const { log, runtime: { ip, hostname }, version } = settings;
2424

2525
return {
2626
track(impressions: ImpressionDecorated[], attributes?: SplitIO.Attributes) {
@@ -56,7 +56,7 @@ export function impressionsTrackerFactory(
5656
}
5757

5858
// @TODO next block might be handled by the integration manager. In that case, the metadata object doesn't need to be passed in the constructor
59-
if (impressionListener || integrationsManager) {
59+
if (settings.impressionListener || integrationsManager) {
6060
for (let i = 0; i < impressionsLength; i++) {
6161
const impressionData: SplitIO.ImpressionData = {
6262
// copy of impression, to avoid unexpected behavior if modified by integrations or impressionListener
@@ -74,7 +74,7 @@ export function impressionsTrackerFactory(
7474
if (integrationsManager) integrationsManager.handleImpression(impressionData);
7575

7676
try { // @ts-ignore. An exception on the listeners should not break the SDK.
77-
if (impressionListener) impressionListener.logImpression(impressionData);
77+
if (settings.impressionListener) settings.impressionListener.logImpression(impressionData);
7878
} catch (err) {
7979
log.error(ERROR_IMPRESSIONS_LISTENER, [err]);
8080
}

0 commit comments

Comments
 (0)