Make a singleton in CoffeeScript
class SingletonClass
    constructor: () ->
        @list = []
    getList: ->
        @list
INSTANCE = undefined
Singleton =
    instance: ->
        if INSTANCE is undefined
            INSTANCE = new SingletonClass()
        INSTANCEWritten by Robin Duckett
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Singleton 
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#

 
 
 
 
