Easier singleton generation

This commit is contained in:
Andrew Stewart 2013-10-23 19:51:40 -07:00
parent b8af863aad
commit 5f83d2f626
2 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
Cylon = require('..').instance() Cylon = require '..'
RobotInfo = RobotInfo =
connection: connection:

View File

@ -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()