a-tomq
Last Updated: February 25, 2016
·
572
· Pplgltch

Coffeescript Singleton

Nothing extraordinary here, just trying coderwall as a new place to store small things I want to remember

class Singleton
    _instance = undefined
    @get: (a...) ->
        _instance ?= new singleton a...

    class singleton extends Antoherclass
        constructor: ()->
            super
            console.info "singleton created"

#########################

  class Antoherclass
    constructor: (world)->
        console.info "hello ", world

#########################

test = Singleton.get "world"