Skip to content

Instantly share code, notes, and snippets.

View timlind's full-sized avatar

Tim Lind timlind

  • Incremental Company
  • Cape Town
  • 23:03 (UTC +02:00)
  • X @timlind
View GitHub Profile
@timlind
timlind / phaseListener.js
Created March 8, 2013 10:45
A jquery plugin to watch for and track events so that they become phases, which allows listeners to attach after the event occurs.
/* A jquery plugin to watch for and track events so that they become phases, which allows listeners to attach after the event occurs. */
$.prototype.capturePhase = function(eventName) {
console.log("Watching for transition to phase " + eventName);
var self = this;
if (!this.__phaseCapturers__) this.__phaseCapturers__ = {};
if (!this.__phaseCapturers__[eventName]) {
this.__phaseCapturers__[eventName] = true;