Easier singleton generation
This commit is contained in:
parent
b8af863aad
commit
5f83d2f626
|
@ -1,4 +1,4 @@
|
|||
Cylon = require('..').instance()
|
||||
Cylon = require '..'
|
||||
|
||||
RobotInfo =
|
||||
connection:
|
||||
|
|
|
@ -15,10 +15,10 @@ require('./logger')
|
|||
|
||||
Logger.setup()
|
||||
|
||||
module.exports = class Cylon
|
||||
class Cylon
|
||||
instance = null
|
||||
|
||||
@instance: (args...) ->
|
||||
@getInstance: (args...) ->
|
||||
instance ?= new Master(args...)
|
||||
|
||||
class Master
|
||||
|
@ -32,3 +32,5 @@ module.exports = class Cylon
|
|||
|
||||
start: ->
|
||||
robot.start() for robot in robots
|
||||
|
||||
module.exports = Cylon.getInstance()
|
||||
|
|
Loading…
Reference in New Issue