Skip to content

Instantly share code, notes, and snippets.

@brentsowers1
Created June 10, 2012 22:59
Show Gist options
  • Save brentsowers1/2907597 to your computer and use it in GitHub Desktop.
Save brentsowers1/2907597 to your computer and use it in GitHub Desktop.
jQuery attachment types common code
var clickStartTime;
function timeAction(localThis, actionFunction) {
var startTime = new Date();
actionFunction.call(localThis);
var endTime = new Date();
alert("Took " + (endTime.getTime() - startTime.getTime()) + " ms to run");
}
function callbackFunction() {
var doneDate = new Date();
var diff = doneDate.getTime() - clickStartTime.getTime();
alert("It took " + diff + " ms");
return false;
}
// All generated content will go in a div with ID container
$(document).ready(function() {
$("#container").mousedown(function() {
clickStartTime = new Date();
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment