27 lines
No EOL
568 B
JavaScript
27 lines
No EOL
568 B
JavaScript
import { EventEmitter } from 'events'
|
|
|
|
export default class Monitor extends EventEmitter {
|
|
constructor(wss, db, encoder, opts = {}) {
|
|
super()
|
|
this.wss = wss
|
|
this.db = db
|
|
this.encoder = encoder
|
|
this.encoder.on('stdout', (data) => {
|
|
console.log('stdout', { data })
|
|
})
|
|
this.encoder.on('stderr', (data) => {
|
|
console.log('stderr', { data })
|
|
})
|
|
this.encoder.on('status', (status) => {
|
|
this.emit('status', status)
|
|
})
|
|
}
|
|
|
|
start() {
|
|
this.encoder.start()
|
|
}
|
|
|
|
status() {
|
|
return this.encoder.status()
|
|
}
|
|
} |