make devices option optional

This commit is contained in:
Sebastian Wiedenroth 2015-11-29 17:02:34 +01:00
parent 31c6fd1290
commit cd48f76ef3

6
dmx.js
View file

@ -3,10 +3,11 @@
var util = require('util') var util = require('util')
var EventEmitter = require('events').EventEmitter var EventEmitter = require('events').EventEmitter
function DMX(devices) { function DMX(options) {
var options = options || {}
this.universes = {} this.universes = {}
this.drivers = {} this.drivers = {}
this.devices = devices this.devices = options.devices || require('./devices')
this.registerDriver('null', require('./drivers/null')) this.registerDriver('null', require('./drivers/null'))
this.registerDriver('enttec-usb-dmx-pro', require('./drivers/enttec-usb-dmx-pro')) this.registerDriver('enttec-usb-dmx-pro', require('./drivers/enttec-usb-dmx-pro'))
@ -15,6 +16,7 @@ function DMX(devices) {
util.inherits(DMX, EventEmitter) util.inherits(DMX, EventEmitter)
DMX.devices = require('./devices')
DMX.Animation = require('./anim') DMX.Animation = require('./anim')
DMX.prototype.registerDriver = function(name, module) { DMX.prototype.registerDriver = function(name, module) {