This is an automated email from the ASF dual-hosted git repository.
jkevan pushed a commit to branch UNOMI-610-new-tracker
in repository https://gitbox.apache.org/repos/asf/unomi-tracker.git
The following commit(s) were added to refs/heads/UNOMI-610-new-tracker by this
push:
new 003ee56 UNOMI-610: base tracker first draft
003ee56 is described below
commit 003ee56a7589d5e7dccdda714ed164df7b849495
Author: Kevan <[email protected]>
AuthorDate: Wed Sep 7 09:10:46 2022 +0200
UNOMI-610: base tracker first draft
---
src/tracker/tracker.js | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/tracker/tracker.js b/src/tracker/tracker.js
index c495d57..0e7571d 100644
--- a/src/tracker/tracker.js
+++ b/src/tracker/tracker.js
@@ -897,11 +897,19 @@ export const newTracker = () => {
}
},
- _registerCallback: function (onLoadCallback, name = "", priority = 0) {
+ /**
+ * This function allow for registering callback that will be executed
once the context is loaded.
+ * @param onLoadCallback the callback to be executed
+ * @param name optional name for the call, used mostly for logging the
execution
+ * @param priority optional priority to execute the callbacks in a
specific order (default: 5, to leave room for the tracker default callback(s))
+ * @private
+ */
+ _registerCallback: function (onLoadCallback, name = undefined,
priority = 5) {
if (wem.digitalData) {
if (wem.cxs) {
console.info('[WEM] digitalData object loaded, calling on
load callback immediately and registering update callback...');
if (onLoadCallback) {
+ console.warn('[WEM] executing context load callback: '
+ (name ? name : 'Callback without name'));
onLoadCallback(wem.digitalData);
}
} else {
@@ -909,8 +917,8 @@ export const newTracker = () => {
if (onLoadCallback) {
wem.digitalData.loadCallbacks =
wem.digitalData.loadCallbacks || [];
wem.digitalData.loadCallbacks.push({
- priority: priority,
- name: name,
+ priority,
+ name,
execute: onLoadCallback
});
}
@@ -921,8 +929,8 @@ export const newTracker = () => {
if (onLoadCallback) {
wem.digitalData.loadCallbacks = [];
wem.digitalData.loadCallbacks.push({
- priority: priority,
- name: name,
+ priority,
+ name,
execute: onLoadCallback
});
}