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