Skip to content

Instantly share code, notes, and snippets.

@halan
Forked from paulodiovani/singleton.coffee
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halan/32cc2706c98d4f4ed825 to your computer and use it in GitHub Desktop.
Save halan/32cc2706c98d4f4ed825 to your computer and use it in GitHub Desktop.
define 'components/singleton', [], ->
###
Singleton class
###
class Singleton extends Backbone.View
# @static
@getInstance = ->
@_instance = new @ unless @_instance?
@_instance
# return a single instance
Singleton.getInstance()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment