2017-01-11 15:11:34 -08:00
|
|
|
'use strict'
|
|
|
|
|
2017-01-21 12:23:45 -08:00
|
|
|
// const expect = require('chai').expect
|
|
|
|
|
|
|
|
const Interrupt = require('../').Interrupt
|
2017-01-18 20:31:53 -08:00
|
|
|
|
2017-01-11 15:11:34 -08:00
|
|
|
//time-stamp for use when watching to distinguish reruns in console
|
|
|
|
// place in alpha first file only
|
|
|
|
let date = new Date(Date.now())
|
|
|
|
console.log(date.getMinutes(), "\:", date.getSeconds())
|
|
|
|
|
2017-01-21 12:21:16 -08:00
|
|
|
let inter17 = new Interrupt(17, { hook: 'a hook to something to do' })
|
2017-01-11 15:11:34 -08:00
|
|
|
|
2017-01-21 23:48:17 -08:00
|
|
|
// inter17.on('fired', hook => {
|
|
|
|
// console.log('Listener fired and returned:', hook)
|
|
|
|
// })
|
2017-01-11 15:11:34 -08:00
|
|
|
|
2017-01-21 23:48:17 -08:00
|
|
|
inter17.on('fired', hook => { counter(hook) })
|
2017-01-21 12:21:16 -08:00
|
|
|
|
|
|
|
inter17.init()
|
2017-01-21 23:48:17 -08:00
|
|
|
.then(() => {
|
|
|
|
console.log('initialzed, waiting for interrupt to fire')
|
2017-01-21 12:21:16 -08:00
|
|
|
})
|
2017-01-21 12:23:45 -08:00
|
|
|
.catch(err => console.log("returned error:", err))
|
2017-01-21 12:21:16 -08:00
|
|
|
|
2017-01-21 23:48:17 -08:00
|
|
|
let count = 0
|
|
|
|
|
|
|
|
function counter(hook) {
|
|
|
|
count++
|
|
|
|
console.log(`******${count}********`)
|
|
|
|
console.log(hook)
|
|
|
|
console.log(`----------------------`)
|
|
|
|
|
|
|
|
}
|