first commit
This commit is contained in:
19
lib/event.js
Normal file
19
lib/event.js
Normal file
@@ -0,0 +1,19 @@
|
||||
var Transform = require('stream').Transform;
|
||||
|
||||
class SSE extends Transform{
|
||||
constructor(options) {
|
||||
super();
|
||||
|
||||
if (!(this instanceof SSE))
|
||||
return new SSE(options);
|
||||
|
||||
options = options || {};
|
||||
Transform.call(this, options);
|
||||
}
|
||||
_transform(data, enc, cb) {
|
||||
this.push('data: ' + data.toString('utf8') + '\n\n');
|
||||
cb();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SSE;
|
||||
Reference in New Issue
Block a user