Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function () {
- "use strict";
- var emitter = require('events').EventEmitter
- , catcher = new emitter()
- , count = 0
- , timeout = 1000 * 1000
- ;
- catcher.on('a', function(num) {
- console.log(num);
- });
- while(timeout > 0) {
- timeout -= 1;
- setTimeout(function() {
- catcher.emit('a', count);
- count += 1;
- }, timeout);
- }
- }());
Add Comment
Please, Sign In to add comment