Skip to content

Instantly share code, notes, and snippets.

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