diff --git a/doc/development/frontend.md b/doc/development/frontend.md index 735b41314ef..c6aafc926ee 100644 --- a/doc/development/frontend.md +++ b/doc/development/frontend.md @@ -227,14 +227,15 @@ class MyThing { gl.MyThing = new MyThing(); // best + let singleton; class MyThing { constructor() { if (!singleton) { - singleton = this; - singleton.init(); - } + singleton = this; + singleton.init(); + } return singleton; } @@ -246,6 +247,7 @@ class MyThing { } gl.MyThing = MyThing; + ``` ## Supported browsers