diff --git a/build/browser/app.js b/build/browser/app.js index 4ac5d007..34e36b83 100644 --- a/build/browser/app.js +++ b/build/browser/app.js @@ -43,6 +43,32 @@ var app = angular.module('ResinEtcher', [ 'ResinEtcher.logger' ]); +// TrackJS integration +// http://docs.trackjs.com/tracker/framework-integrations +app.config(function($provide) { + 'use strict'; + + $provide.decorator('$exceptionHandler', function($delegate, $window) { + return function(exception, cause) { + $window.trackJs.track(exception); + $delegate(exception, cause); + }; + }); + + $provide.decorator('$log', function($delegate, $window) { + + // Save the original $log.debug() + var debugFn = $delegate.debug; + + $delegate.debug = function(message) { + $window.trackJs.console.debug(message); + debugFn.call(null, message); + }; + + return $delegate; + }); +}); + app.controller('AppController', function($q, DriveScannerService, SelectionStateService, ImageWriterService, LoggerService) { 'use strict'; diff --git a/lib/browser/app.js b/lib/browser/app.js index 6253d097..83e70c8c 100644 --- a/lib/browser/app.js +++ b/lib/browser/app.js @@ -42,6 +42,32 @@ var app = angular.module('ResinEtcher', [ 'ResinEtcher.logger' ]); +// TrackJS integration +// http://docs.trackjs.com/tracker/framework-integrations +app.config(function($provide) { + 'use strict'; + + $provide.decorator('$exceptionHandler', function($delegate, $window) { + return function(exception, cause) { + $window.trackJs.track(exception); + $delegate(exception, cause); + }; + }); + + $provide.decorator('$log', function($delegate, $window) { + + // Save the original $log.debug() + var debugFn = $delegate.debug; + + $delegate.debug = function(message) { + $window.trackJs.console.debug(message); + debugFn.call(null, message); + }; + + return $delegate; + }); +}); + app.controller('AppController', function($q, DriveScannerService, SelectionStateService, ImageWriterService, LoggerService) { 'use strict'; diff --git a/lib/index.html b/lib/index.html index af569951..0f4c252e 100644 --- a/lib/index.html +++ b/lib/index.html @@ -12,6 +12,11 @@ + + + + +
diff --git a/vendor/tracker.js b/vendor/tracker.js new file mode 100644 index 00000000..12eec2f2 --- /dev/null +++ b/vendor/tracker.js @@ -0,0 +1,42 @@ +// COPYRIGHT (c) 2015 TrackJS LLC ALL RIGHTS RESERVED +(function(h,q,k){"use awesome";if(h.trackJs)h.console&&h.console.warn&&h.console.warn("TrackJS global conflict");else{var l=function(a,b,c,d,e){this.util=a;this.onError=b;this.onFault=c;this.options=e;e.enabled&&this.initialize(d)};l.prototype={initialize:function(a){a.addEventListener&&(this.wrapAndCatch(a.Element.prototype,"addEventListener",1),this.wrapAndCatch(a.XMLHttpRequest.prototype,"addEventListener",1),this.wrapRemoveEventListener(a.Element.prototype),this.wrapRemoveEventListener(a.XMLHttpRequest.prototype)); +this.wrapAndCatch(a,"setTimeout",0);this.wrapAndCatch(a,"setInterval",0)},wrapAndCatch:function(a,b,c){var d=this,e=a[b];d.util.hasFunction(e,"apply")&&(a[b]=function(){try{var f=Array.prototype.slice.call(arguments),g=f[c],v,h;if(d.options.bindStack)try{throw Error();}catch(k){h=k.stack,v=d.util.isoNow()}if("addEventListener"===b&&(this._trackJsEvt||(this._trackJsEvt=new m),this._trackJsEvt.getWrapped(f[0],g,f[2])))return;g&&d.util.hasFunction(g,"apply")&&(f[c]=function(){try{return g.apply(this, +arguments)}catch(a){throw d.onError("catch",a,{bindTime:v,bindStack:h}),d.util.wrapError(a);}},"addEventListener"===b&&this._trackJsEvt.add(f[0],g,f[2],f[c]));return e.apply(this,f)}catch(l){a[b]=e,d.onFault(l)}})},wrapRemoveEventListener:function(a){if(a&&a.removeEventListener&&this.util.hasFunction(a.removeEventListener,"call")){var b=a.removeEventListener;a.removeEventListener=function(a,d,e){if(this._trackJsEvt){var f=this._trackJsEvt.getWrapped(a,d,e);f&&this._trackJsEvt.remove(a,d,e);return b.call(this, +a,f,e)}return b.call(this,a,d,e)}}}};var m=function(){this.events=[]};m.prototype={add:function(a,b,c,d){-1>=this.indexOf(a,b,c)&&this.events.push([a,b,!!c,d])},remove:function(a,b,c){a=this.indexOf(a,b,!!c);0<=a&&this.events.splice(a,1)},getWrapped:function(a,b,c){a=this.indexOf(a,b,!!c);return 0<=a?this.events[a][3]:k},indexOf:function(a,b,c){for(var d=0;d