-
Notifications
You must be signed in to change notification settings - Fork 0
/
pingmelive.min.js
1 lines (1 loc) · 1.41 KB
/
pingmelive.min.js
1
"use strict";var pingMeLive=function(e,t,r,n){function i(e){return(e<10?"0":"")+e}var o=Date.now();o=(o=new Date(o)).getFullYear()+"-"+i(o.getMonth()+1)+"-"+i(o.getDate())+" "+i(o.getHours())+":"+i(o.getMinutes())+":"+i(o.getSeconds()),this.apiKey=e,this.projectID=t,this.errorStatus=r,this.errorTitle=n,this.eventDateTime=o,pingMeLive.prototype.sendData=function(e){var t=new XMLHttpRequest;t.addEventListener("load",function(e){}),t.addEventListener("error",function(e){}),t.open("POST","https://pingmelive.com/event/push"),t.setRequestHeader("Content-Type","application/json"),t.setRequestHeader("ApiKey",this.apiKey),t.setRequestHeader("projectID",this.projectID);var r=JSON.stringify(e);t.send(r)},pingMeLive.prototype.pingError=function(e,t,r,n,i){var o={"Error Summary":["Message: "+e,"URL: "+t,"Line: "+r,"Column: "+n,"Error object: "+JSON.stringify(i)].join("\n"),"Browser Platform":navigator.platform,"Browser userAgent":navigator.userAgent,Url:window.location.href,Hostname:location.host};this.sendData({groupTitle:this.errorTitle,message:e,detailedText:JSON.stringify(o)})},pingMeLive.prototype.simpleEvent=function(e,t){this.sendData({groupTitle:e,message:t,detailedText:""})},pingMeLive.prototype.detailedEvent=function(e,t,r){this.sendData({groupTitle:e,message:t,detailedText:r})},!0===this.errorStatus&&window.addEventListener("error",function(e){return pingMeLive.pingError(e.message,e.filename,e.lineno,e.colno,e.error),!1})};