Skip to content

Instantly share code, notes, and snippets.

@iarry
Last active April 9, 2017 17:38
Show Gist options
  • Save iarry/f64fc56797f4ae3c865d2392fb5c2562 to your computer and use it in GitHub Desktop.
Save iarry/f64fc56797f4ae3c865d2392fb5c2562 to your computer and use it in GitHub Desktop.
// Singleton instance
let instance;
// Singleton class
const Singleton = class Singleton {
constructor(params){
// Instantiating instance as Singleton
if(!instance){
instance = this;
}
// Returning instance of Singleton
return instance;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment