Skip to content

Instantly share code, notes, and snippets.

@DragorWW
Created February 10, 2016 05:28
Show Gist options
  • Select an option

  • Save DragorWW/7e82f7db65afcaa229d1 to your computer and use it in GitHub Desktop.

Select an option

Save DragorWW/7e82f7db65afcaa229d1 to your computer and use it in GitHub Desktop.
javascript es2015 singleton patter
let instances;
class MyClass {
constructor() {
if (!instances) {
instances = this;
}
return instances;
}
}
export default new MyClass;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment