Proper initialization of adaptors
This commit is contained in:
parent
541d70b66d
commit
bf4d42970e
|
@ -29,5 +29,5 @@ module.exports = class Connection
|
||||||
@adaptor.disconnect
|
@adaptor.disconnect
|
||||||
|
|
||||||
requireAdaptor: (adaptorName) ->
|
requireAdaptor: (adaptorName) ->
|
||||||
console.log "dynamic load adaptor"
|
Logger.info "dynamic load adaptor"
|
||||||
@robot.requireAdaptor(adaptorName, self)
|
@robot.requireAdaptor(adaptorName, self)
|
||||||
|
|
|
@ -20,6 +20,7 @@ class Loopback
|
||||||
|
|
||||||
connect: ->
|
connect: ->
|
||||||
console.log "Connecting to adaptor '#{@name}'..."
|
console.log "Connecting to adaptor '#{@name}'..."
|
||||||
|
self
|
||||||
|
|
||||||
disconnect: ->
|
disconnect: ->
|
||||||
console.log "Disconnecting from adaptor '#{@name}'..."
|
console.log "Disconnecting from adaptor '#{@name}'..."
|
||||||
|
|
|
@ -72,6 +72,9 @@ module.exports = class Robot
|
||||||
require("cylon-#{adaptorName}").register(self) unless self.adaptors[adaptorName]?
|
require("cylon-#{adaptorName}").register(self) unless self.adaptors[adaptorName]?
|
||||||
require(self.adaptors[adaptorName]).adaptor(name: adaptorName).connect(connection: connection)
|
require(self.adaptors[adaptorName]).adaptor(name: adaptorName).connect(connection: connection)
|
||||||
|
|
||||||
|
requireAdaptor: (adaptorName, connection) ->
|
||||||
|
self.requireAdaptor(adaptorName, connection)
|
||||||
|
|
||||||
registerAdaptor: (moduleName, adaptorName) ->
|
registerAdaptor: (moduleName, adaptorName) ->
|
||||||
return if self.adaptors[adaptorName]?
|
return if self.adaptors[adaptorName]?
|
||||||
self.adaptors[adaptorName] = moduleName
|
self.adaptors[adaptorName] = moduleName
|
||||||
|
|
Loading…
Reference in New Issue