javascript singleton question

前端 未结 10 2043
闹比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:21

    Crockford (seems to) agree that the object literal is all you need for a singleton in JavaScript:

    http://webcache.googleusercontent.com/search?q=cache:-j5RwC92YU8J:www.crockford.com/codecamp/The%2520Good%2520Parts%2520ppt/5%2520functional.ppt+singleton+site:www.crockford.com&cd=1&hl=en&ct=clnk

提交回复
热议问题