javascript singleton question

前端 未结 10 2044
闹比i
闹比i 2020-12-12 20:08

I just read a few threads on the discussion of singleton design in javascript. I\'m 100% new to the Design Pattern stuff but as I see since a Singleton by definition won\'t

10条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 20:13

    The latter code box shows what I've seen JS devs call their version of OO design in Javascript.

    Singetons are meant to be singular objects that can't be constructed (except, I suppose, in the initial definition. You have one, global instance of a singleton.

提交回复
热议问题