Commit ad82eb2e authored by grundmanise's avatar grundmanise

Fix prototype reference in singleton example

Prototype is only accessible on a constructor function.
In case of classes, constructor function is accessible via a declared class name.
parent 0fc68a74
......@@ -31,11 +31,11 @@ export default new MyThing();
export default class MyThing {
constructor() {
if (!this.prototype.singleton) {
if (!MyThing.prototype.singleton) {
this.init();
this.prototype.singleton = this;
MyThing.prototype.singleton = this;
}
return this.prototype.singleton;
return MyThing.prototype.singleton;
}
init() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment