0.0.4 switch class name of Queue to Runner. Add index.js for both and to main in package.json

master
David Kebler 2020-05-28 16:08:59 -07:00
parent 7a69d7ad07
commit 67955d3260
4 changed files with 11 additions and 8 deletions

View File

@ -6,3 +6,4 @@ examples/
*.lock
.eslintrc.js
.travis.yml
archive/

View File

@ -1,5 +1,5 @@
import Schedule from '../src/schedule.js'
import Queue from '../src/queue.js'
import Runner from '../src/runner.js'
const HOUR = 0
const MINUTE = 0
@ -26,11 +26,11 @@ for (let zone=0; zone < NZONES; zone++) {
zones[zone].update()
}
const queue = new Queue ({
const runner = new Runner ({
name: 'irrigation',
// one: true,
schedules: zones,
})
queue.start()
setTimeout(() => {queue.kill()},10*1000)
runner.start()
setTimeout(() => {runner.stop(true)},10*1000)

View File

@ -1,8 +1,9 @@
{
"name": "scheduler",
"version": "0.0.1",
"name": "@uci-utils/scheduler",
"version": "0.0.4",
"description": "an irrigation style scheduler interfacing with Home Assistant",
"type": "module",
"main": "src/index.js",
"scripts": {
"start": "node ./example/scheduler.js",
"dev": "UCI_ENV=dev nodemon -r esm ./",

View File

@ -9,8 +9,9 @@ import 'moment-duration-format'
class UCISchedule extends EventEmitter {
constructor(opts) {
super(opts)
this.name = opts.name || 'test_schedule'
this.id = opts.id || this.name
this.name = opts.name || 'test'
this.id = opts.id || this.name.replace(/ /g, '_')
this.desc = opts.desc
this.hour = opts.hour || 0
this.dev = opts.dev || process.env.UCI_ENV==='dev'
this.minute = opts.minute || 0