Skip to content

Instantly share code, notes, and snippets.

@irohiroki
Created January 17, 2012 00:30
Show Gist options
  • Save irohiroki/1623798 to your computer and use it in GitHub Desktop.
Save irohiroki/1623798 to your computer and use it in GitHub Desktop.
Singleton class in CoffeeScript
app = window.app
class app.Singleton
instance = null
@get: ->
unless instance
instance = new this
instance.init()
instance
init: ->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment