Skip to content

Commit bc6b938

Browse files
Update event processing to use setLocalSessionAttribute and improve readiness checks
1 parent 4f90dd1 commit bc6b938

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/Rokt-Kit.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,11 @@ var constructor = function () {
254254
}
255255

256256
function processEvent(event) {
257-
if (!isKitReady()) {
257+
if (
258+
!isKitReady() ||
259+
!self.store ||
260+
!self.store.hasOwnProperty('setLocalSessionAttribute')
261+
) {
258262
return;
259263
}
260264

@@ -266,11 +270,7 @@ var constructor = function () {
266270

267271
if (self.placementEventMappingLookup[hashedEvent]) {
268272
var mappedValue = self.placementEventMappingLookup[hashedEvent];
269-
if (self.store) {
270-
var attrs = {};
271-
attrs[mappedValue] = true;
272-
self.store.setLocalSessionAttributes(attrs);
273-
}
273+
self.store.setLocalSessionAttribute(mappedValue, true);
274274
}
275275
}
276276

test/src/tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ describe('Rokt Forwarder', () => {
8181
};
8282
mParticle._Store = {
8383
localSessionAttributes: {},
84-
setLocalSessionAttributes: function (attributes) {
85-
this.localSessionAttributes = attributes;
84+
setLocalSessionAttribute: function (key, value) {
85+
this.localSessionAttributes[key] = value;
8686
},
8787
getLocalSessionAttributes: function () {
8888
return this.localSessionAttributes;

0 commit comments

Comments
 (0)