Skip to content

Instantly share code, notes, and snippets.

@OzieWest
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save OzieWest/378b673dd2f9f3aff4b7 to your computer and use it in GitHub Desktop.

Select an option

Save OzieWest/378b673dd2f9f3aff4b7 to your computer and use it in GitHub Desktop.
AngularJS
$rootScope.$broadcast('scanner-started', { any: {} });
$scope.$on('scanner-started', function(event, args) {
var anyThing = args.any;
});
module.factory('timestampMarker', [function() {
var timestampMarker = {
request: function(config) {
config.requestTimestamp = new Date().getTime();
return config;
},
response: function(response) {
response.config.responseTimestamp = new Date().getTime();
return response;
}
};
return timestampMarker;
}]);
module.config(['$httpProvider', function($httpProvider) {
$httpProvider.interceptors.push('timestampMarker');
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment