35 lines
810 B
JavaScript
35 lines
810 B
JavaScript
'use strict'
|
|
|
|
// const expect = require('chai').expect
|
|
|
|
const Interrupt = require('../').Interrupt
|
|
|
|
//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())
|
|
|
|
let inter17 = new Interrupt(17, { hook: 'a hook to something to do' })
|
|
|
|
// inter17.on('fired', hook => {
|
|
// console.log('Listener fired and returned:', hook)
|
|
// })
|
|
|
|
inter17.on('fired', hook => { counter(hook) })
|
|
|
|
inter17.init()
|
|
.then(() => {
|
|
console.log('initialzed, waiting for interrupt to fire')
|
|
})
|
|
.catch(err => console.log("returned error:", err))
|
|
|
|
let count = 0
|
|
|
|
function counter(hook) {
|
|
count++
|
|
console.log(`******${count}********`)
|
|
console.log(hook)
|
|
console.log(`----------------------`)
|
|
|
|
}
|