0.0.4 switch class name of Queue to Runner. Add index.js for both and to main in package.json
parent
7a69d7ad07
commit
67955d3260
|
@ -6,3 +6,4 @@ examples/
|
||||||
*.lock
|
*.lock
|
||||||
.eslintrc.js
|
.eslintrc.js
|
||||||
.travis.yml
|
.travis.yml
|
||||||
|
archive/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Schedule from '../src/schedule.js'
|
import Schedule from '../src/schedule.js'
|
||||||
import Queue from '../src/queue.js'
|
import Runner from '../src/runner.js'
|
||||||
|
|
||||||
const HOUR = 0
|
const HOUR = 0
|
||||||
const MINUTE = 0
|
const MINUTE = 0
|
||||||
|
@ -26,11 +26,11 @@ for (let zone=0; zone < NZONES; zone++) {
|
||||||
zones[zone].update()
|
zones[zone].update()
|
||||||
}
|
}
|
||||||
|
|
||||||
const queue = new Queue ({
|
const runner = new Runner ({
|
||||||
name: 'irrigation',
|
name: 'irrigation',
|
||||||
// one: true,
|
// one: true,
|
||||||
schedules: zones,
|
schedules: zones,
|
||||||
})
|
})
|
||||||
|
|
||||||
queue.start()
|
runner.start()
|
||||||
setTimeout(() => {queue.kill()},10*1000)
|
setTimeout(() => {runner.stop(true)},10*1000)
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "scheduler",
|
"name": "@uci-utils/scheduler",
|
||||||
"version": "0.0.1",
|
"version": "0.0.4",
|
||||||
"description": "an irrigation style scheduler interfacing with Home Assistant",
|
"description": "an irrigation style scheduler interfacing with Home Assistant",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./example/scheduler.js",
|
"start": "node ./example/scheduler.js",
|
||||||
"dev": "UCI_ENV=dev nodemon -r esm ./",
|
"dev": "UCI_ENV=dev nodemon -r esm ./",
|
||||||
|
|
|
@ -9,8 +9,9 @@ import 'moment-duration-format'
|
||||||
class UCISchedule extends EventEmitter {
|
class UCISchedule extends EventEmitter {
|
||||||
constructor(opts) {
|
constructor(opts) {
|
||||||
super(opts)
|
super(opts)
|
||||||
this.name = opts.name || 'test_schedule'
|
this.name = opts.name || 'test'
|
||||||
this.id = opts.id || this.name
|
this.id = opts.id || this.name.replace(/ /g, '_')
|
||||||
|
this.desc = opts.desc
|
||||||
this.hour = opts.hour || 0
|
this.hour = opts.hour || 0
|
||||||
this.dev = opts.dev || process.env.UCI_ENV==='dev'
|
this.dev = opts.dev || process.env.UCI_ENV==='dev'
|
||||||
this.minute = opts.minute || 0
|
this.minute = opts.minute || 0
|
||||||
|
|
Loading…
Reference in New Issue