You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@senssoft.apache.org by cg...@apache.org on 2017/01/11 21:59:00 UTC
incubator-senssoft-useralejs git commit: ASF Website demo
modifications
Repository: incubator-senssoft-useralejs
Updated Branches:
refs/heads/website-demo [created] 08dac57a4
ASF Website demo modifications
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/08dac57a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/08dac57a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/08dac57a
Branch: refs/heads/website-demo
Commit: 08dac57a4e41e87aa58da6a2203836a7b6c80c57
Parents: 0ab4c86
Author: Clay Gimenez <cg...@draper.com>
Authored: Wed Jan 11 16:58:37 2017 -0500
Committer: Clay Gimenez <cg...@draper.com>
Committed: Wed Jan 11 16:58:37 2017 -0500
----------------------------------------------------------------------
package.json | 2 +-
src/packageLogs.js | 9 +++++++--
src/sendLogs.js | 21 ++++++++++++++++++---
3 files changed, 26 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/08dac57a/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 419feac..9f494f6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "useralejs",
- "version": "0.2.1",
+ "version": "demo",
"description": "Javascript Client for UserAle",
"main": "build/userale.js",
"scripts": {
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/08dac57a/src/packageLogs.js
----------------------------------------------------------------------
diff --git a/src/packageLogs.js b/src/packageLogs.js
index 9e9b85a..8fd4dd8 100644
--- a/src/packageLogs.js
+++ b/src/packageLogs.js
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,6 +47,11 @@ export function packageLog(e, detailFcn) {
'useraleVersion': config.useraleVersion
};
+ // Demo functionality -- callback triggered on each new log
+ if (config.logCb) {
+ config.logCb(log);
+ }
+
logs.push(log);
return true;
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/08dac57a/src/sendLogs.js
----------------------------------------------------------------------
diff --git a/src/sendLogs.js b/src/sendLogs.js
index 7aa7323..75e467a 100644
--- a/src/sendLogs.js
+++ b/src/sendLogs.js
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,6 +22,11 @@ export function initSender(logs, config) {
export function sendOnInterval(logs, config) {
setInterval(function() {
+ // Demo capability to not send logs
+ if (config.noSend) {
+ return false;
+ }
+
if (logs.length >= config.logCountThreshold) {
sendLogs(logs.slice(0), config.url, 0); // Send a copy
logs.splice(0); // Clear array reference (no reassignment)
@@ -32,14 +37,24 @@ export function sendOnInterval(logs, config) {
export function sendOnClose(logs, config) {
if (navigator.sendBeacon) {
window.addEventListener('unload', function() {
+ // Demo capability to not send logs
+ if (config.noSend) {
+ return false;
+ }
+
navigator.sendBeacon(config.url, JSON.stringify(logs));
});
} else {
window.addEventListener('beforeunload', function() {
if (logs.length > 0) {
+ // Demo capability to not send logs
+ if (config.noSend) {
+ return false;
+ }
+
sendLogs(logs, config.url, 1);
}
- })
+ });
}
}