Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added callback parameter so you could track the state of your error #45

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

added callback parameter so you could track the state of your error

  • Loading branch information
MarijusZelba committed Jan 13, 2017
commit bf360b9bff882e6d38d38bcb1c64eb0de3e69a97

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -95,7 +95,7 @@
}
}
},
push: function(data) {
push: function(data, callback) {
var type = typeof data;

if( !data || !(type === 'object' || type === 'string') ) {
@@ -142,11 +142,11 @@
return;
}

self.track(data);
self.track(data, callback);


},
track: function(data) {
track: function(data, callback) {
// inject session id
data.sessionId = this.session_id;

@@ -156,7 +156,10 @@
xmlHttp.open('POST', this.inputUrl, true); //true for asynchronous request
xmlHttp.setRequestHeader('Content-Type', 'text/plain');
xmlHttp.send(JSON.stringify(data));

if(typeof callback === "function"){
xmlHttp.onreadystatechange = function(event){callback(event,data)};
}

} catch (ex) {
if (window && window.console && typeof window.console.log === 'function') {
console.log("Failed to log to loggly because of this exception:\n" + ex);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.