You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flagon.apache.org by po...@apache.org on 2019/11/05 03:02:47 UTC

[incubator-flagon-useralejs] branch FLAGON-469 updated: [FLAGON-467] minor mods to examples

This is an automated email from the ASF dual-hosted git repository.

poorejc pushed a commit to branch FLAGON-469
in repository https://gitbox.apache.org/repos/asf/incubator-flagon-useralejs.git


The following commit(s) were added to refs/heads/FLAGON-469 by this push:
     new 9a0f12b  [FLAGON-467] minor mods to examples
9a0f12b is described below

commit 9a0f12bf6b829189702b76a3942400ecad3425f6
Author: poorejc <po...@apache.org>
AuthorDate: Mon Nov 4 22:02:37 2019 -0500

    [FLAGON-467] minor mods to examples
---
 example/aleAPI.js  | 9 ++++++---
 example/index.html | 4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/example/aleAPI.js b/example/aleAPI.js
index 87d1a4d..432371d 100644
--- a/example/aleAPI.js
+++ b/example/aleAPI.js
@@ -25,7 +25,7 @@ window.userale.options({
 
 /**Try out the 'Filter' API to eliminate the logs that you don't want!*/
 window.userale.filter(function (log) {
-    var type_array = ['mouseup', 'mouseover', 'mousedown', 'dblclick', 'blur', 'focus'];
+    var type_array = ['mouseup', 'mouseover', 'mousedown', 'keydown', 'dblclick', 'blur', 'focus'];
     var logType_array = ['interval'];
     return !type_array.includes(log.type) && !logType_array.includes(log.logType);
 });
@@ -33,10 +33,11 @@ window.userale.filter(function (log) {
 /**Log Mapping API
 
 /**Play around with the 'Mapping' API to add or modify existing fields in your logs!*/
+/**the example below modifies fields attached to logs on the "Click Me" button on the Example page*/
 window.userale.map(function (log) {
     var targetsForLabels = ["button#test_button"];
     if (targetsForLabels.includes(log.target)) {
-        return Object.assign({}, log, { customLabel: "Click me!" });
+        return Object.assign({}, log, { customLabel: "Click Me!" });
     } else {
         return log;
     }
@@ -46,6 +47,7 @@ window.userale.map(function (log) {
 
 /**Check out the 'log' API to generate custom events and add them to the log queue! The possibilities are endless
 /*You can fully customize your custom logs and define any data schema that suits you*/
+/**this example works with the "Test Field" form element on the Example Page*/
 document.addEventListener('change', function(e) {
     if (e.target.value === 'goodbye') {
         window.userale.log({
@@ -56,7 +58,7 @@ document.addEventListener('change', function(e) {
             type: 'change',
             logType: 'custom',
             userAction: false,
-            detail: 'disinterested user',
+            details: 'disinterested user',
             userId: window.userale.options.userId,
             toolVersion: window.userale.options.toolVersion,
             toolName: window.userale.options.toolName,
@@ -68,6 +70,7 @@ document.addEventListener('change', function(e) {
 });
 
 /**Alternatively, you can use UserALE.js' own packaging function for HTML events to strive for standardization!*/
+/**this example works with the "Test Field" form element on the Example Page*/
 document.addEventListener('change', function(e){
     if (e.target.value === 'hello') {
         window.userale.packageLog(e, function(){return "cool user!"});
diff --git a/example/index.html b/example/index.html
index 2a36ce1..46412ac 100644
--- a/example/index.html
+++ b/example/index.html
@@ -18,7 +18,7 @@ limitations under the License.
 
   <!-- Load UserALE.js and set logging parameters-->
   <script
-          src="file:///Users/jpoore/Documents/Apache_Flagon/dev/incubator-flagon-useralejs/build/userale-2.0.2.min.js"
+          src="file:///.../Apache_Flagon/dev/incubator-flagon-useralejs/build/userale-2.0.2.min.js"
           data-url="http://localhost:8000/"
           data-user="example-user"
           data-log-details="true"
@@ -27,7 +27,7 @@ limitations under the License.
   ></script>
   <!-- Load UserALE.js API calls to modify log stream -->
   <script
-          src="file:///Users/jpoore/Documents/Apache_Flagon/dev/npmUserAleExample/aleMods.js"
+          src="file:///.../Apache_Flagon/dev/incubator-flagon-useralejs/example/aleAPI.js"
   ></script>
 </head>
 <body>