2018-03-04 15:09:18 -08:00
|
|
|
import Interrupt from '../src/interrupt'
|
|
|
|
|
2018-07-31 10:05:13 -07:00
|
|
|
// const delay = time => new Promise(res=>setTimeout(()=>res(),time))
|
2018-03-04 15:09:18 -08:00
|
|
|
|
2018-07-31 10:05:13 -07:00
|
|
|
let interrupt = new Interrupt(24,{id:'test-interrupt', wait:0, hook:true, useRootNS:true})
|
2018-03-04 15:09:18 -08:00
|
|
|
|
|
|
|
;
|
|
|
|
(async () => {
|
|
|
|
|
2018-07-01 15:37:59 -07:00
|
|
|
await interrupt.init()
|
|
|
|
console.log('interrupt ready and waiting')
|
2018-07-31 10:05:13 -07:00
|
|
|
console.log('manual fire of interrupt via interrupt instance')
|
|
|
|
interrupt.fire()
|
|
|
|
console.log('manual fire of interrupt via interrupt instance after changing hook')
|
|
|
|
interrupt.hook = (packet) => {
|
|
|
|
packet.data='some hook added data'
|
|
|
|
console.log('custom hook function modifies', packet)
|
|
|
|
return packet
|
|
|
|
}
|
|
|
|
interrupt.fire()
|
2018-03-04 15:09:18 -08:00
|
|
|
// await delay(3000)
|
|
|
|
// process.kill(process.pid, 'SIGTERM')
|
|
|
|
|
|
|
|
})().catch(err => {
|
|
|
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
2018-07-31 10:05:13 -07:00
|
|
|
process.kill(process.pid, 'SIGTERM')
|
2018-03-04 15:09:18 -08:00
|
|
|
})
|