src/PhantomPoll.js
function(callback) {
		if (this.creating && callback) {
			this.waiting.push(callback);
		} else {
			var that = this;
			this.creating = true;
			phantom.create(this.flags, this.options, function(ph) {
				that.instance = ph;
				that.creating = false;
				that.waiting.forEach(function(callback) {
					callback(ph);
				});
				that.waiting = [];
			});
		}
	}
function(callback) {
		if (this.creating && callback) {
			this.waiting.push(callback);
		} else {
			var that = this;
			this.creating = true;
			phantom.create(this.flags, this.options, function(ph) {
				that.instance = ph;
				that.creating = false;
				that.waiting.forEach(function(callback) {
					callback(ph);
				});
				that.waiting = [];
			});
		}
	}
function ( callback ) { if ( this . creating && callback ) { this . waiting . push ( callback ) ; } else { var that = this ; this . creating = true ; phantom . create ( this . flags , this . options , function ( ph ) { that . instance = ph ; that . creating = false ; that . waiting . forEach ( function ( callback ) { callback ( ph ) ; } ) ; that . waiting = [ ] ; } ) ; } }
Creates PhantomJS instance if needed be, and when it's done
triggers all the callbacks.

@param  {!function(?)} callback Function to be called when the
instance is created, if a phantom instance is waiting to be
created the callback will be added to a waiting list.
@private
Creates PhantomJS instance if needed be and when it s done triggers all the callbacks .