Glavin001 / pageshot

Take screenshots triggered by browser-side JavaScript.
MIT License
1 stars 0 forks source link

Pageshot should return Event Emitter for async tracking #6

Open Glavin001 opened 10 years ago

Glavin001 commented 10 years ago

Pageshot should return Event Emitter for async tracking.

Events

  • [x] Create Phantom
  • [x] Create Page
  • [x] onConsoleMessage
  • [x] Quit
  • [x] Shoot
  • [x] Page open
  • [x] Inject Pageshot for browser
  • [x] Inject pageshot config script
Glavin001 commented 10 years ago

See http://www.sitepoint.com/nodejs-events-and-eventemitter/

For example:

var events = require('events');
 
function Door(colour) {
  this.colour = colour;
  events.EventEmitter.call(this);
 
  this.open = function()
  {
  this.emit('open');
  }
}
 
Door.prototype.__proto__ = events.EventEmitter.prototype;
 
var frontDoor = new Door('brown');
 
frontDoor.on('open', function() {
    console.log('ring ring ring');
  });
frontDoor.open();