Last active
August 29, 2015 14:13
-
-
Save paulodiovani/8b8737640826111d5c1b to your computer and use it in GitHub Desktop.
Singleton example using Require.js + BackBone.js + CoffeeScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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