I'm trying to pass "this" as an argument to Spooky.emit, but I get no output. This is my code:
var Spooky = require('spooky');
var spooky = new Spooky({
child: {
transport: 'http'
},
casper: {
logLevel: 'debug',
verbose: true
}
}, function() {
spooky.start(
'http://google.com');
spooky.then(function() {
this.emit('msg', this);
});
spooky.run();
});
spooky.on('msg', function(msg) {
console.log(msg);
});
Someone knows what could be wrong here?