UncleGedd commented on code in PR #350:
URL: 
https://github.com/apache/incubator-flagon-useralejs/pull/350#discussion_r1151912429


##########
example/index.js:
##########
@@ -34,28 +34,26 @@ window.userale.options({
  * Note that for surgical filters, you may need to clear or reset back to a 
global filter callback
  * the same is true for the 'map' API. See examples below:
  */
-window.userale.filter(function (log) {
-    var type_array = ['mouseup', 'mouseover', 'mousedown', 'keydown', 
'dblclick', 'blur', 'focus', 'input', 'wheel'];
-    var logType_array = ['interval'];
-    return !type_array.includes(log.type) && 
!logType_array.includes(log.logType);
+window.userale.addCallbacks({
+    filter(log) {
+        var type_array = ['mouseup', 'mouseover', 'mousedown', 'keydown', 
'dblclick', 'blur', 'focus', 'input', 'wheel'];
+        var logType_array = ['interval'];
+        return !type_array.includes(log.type) && 
!logType_array.includes(log.logType);
+    }
 });
 
 /**Log Mapping API
  *
  * the 'map' API allows you to add or modify new fields to your logs
  * this example works with the "Click Me!" button at the top of index.html
  */
-document.addEventListener('click', function(e){
-    if (e.target.innerHTML === 'Click Me!') {
-        window.userale.map(function (log) {
+window.userale.addCallbacks({
+    map(log, e) {
+        if(e && e.type === 'click' && e.target.innerHTML === 'Click Me!') {

Review Comment:
   Correct me if I'm wrong here, but isn't `document.addEventListener('click', 
...` doing something fundamentally different than `userale.addCallbacks`? The 
former is a browser function while the latter is a userale function. Does this 
mean that the callbacks in `userale.addCallbacks` will be exected at every 
event?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@flagon.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to