mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 16:30:11 +00:00
Verbs are event emitters.
Let verbs source events through EventEmitter. Using aggregation is a bit simpler here than extending because of the Resig "Class" stuff.
This commit is contained in:
parent
43564bf380
commit
d77b484e55
@ -11,7 +11,9 @@ Definition of the Verb class.
|
|||||||
|
|
||||||
|
|
||||||
// Use J. Resig's nifty class implementation
|
// Use J. Resig's nifty class implementation
|
||||||
var Class = require( '../utils/class' );
|
var Class = require( '../utils/class' )
|
||||||
|
, EVENTS = require('events');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -21,8 +23,14 @@ Definition of the Verb class.
|
|||||||
*/
|
*/
|
||||||
var Verb = module.exports = Class.extend({
|
var Verb = module.exports = Class.extend({
|
||||||
|
|
||||||
|
init: function() {
|
||||||
|
this.emitter = new EVENTS.EventEmitter();
|
||||||
|
},
|
||||||
|
|
||||||
|
on: function() {
|
||||||
|
this.emitter.on.apply( this.emitter, arguments );
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
@ -32,6 +32,10 @@ Implementation of the 'generate' verb for HackMyResume.
|
|||||||
|
|
||||||
var BuildVerb = module.exports = Verb.extend({
|
var BuildVerb = module.exports = Verb.extend({
|
||||||
|
|
||||||
|
init: function() {
|
||||||
|
this._super();
|
||||||
|
},
|
||||||
|
|
||||||
invoke: function() {
|
invoke: function() {
|
||||||
build.apply( this, arguments );
|
build.apply( this, arguments );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user