Skip to content

Commit c2f6df3

Browse files
committed
changed handling and detection of multiple entries
1 parent 97bca30 commit c2f6df3

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

dist/breinify-activities.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@
275275

276276
const defaultObserverOption = {
277277
settings: {
278-
setupEvenIfEvaluated: false,
279278
bindDataByTag: false,
280279
evaluateOnSetup: false,
281280
onActivation: function (settings, eventData, user, tags) {
@@ -462,18 +461,20 @@
462461
}
463462

464463
const normalizedSettings = activityDomObserver.normalizeSettings(observerType, settings);
465-
if (normalizedSettings.setupEvenIfEvaluated !== true &&
466-
$el.attr('data-' + this.marker.activate) === 'evaluated') {
467-
return;
468-
}
469-
470464
const normalizedData = activityDomObserver.normalizeData(observerType, settings, data);
471465

466+
// get any data currently attached
472467
let currentData = activityDomObserver.readElementData($el);
473468
if (!$.isArray(currentData)) {
474469
currentData = [];
475470
}
476471

472+
// check if this observer is already attached (based on the id)
473+
const id = Breinify.UTL.isNonEmptyString(normalizedSettings.id);
474+
if (id !== null && currentData.some(d => $.isPlainObject(d.settings.id) && d.settings.id === id)) {
475+
return;
476+
}
477+
477478
currentData.push({
478479
observe: observerType,
479480
settings: normalizedSettings,

0 commit comments

Comments
 (0)