News for hackers. Stuff that matters.
Re:Show HN: Nsynjs – JS engine with stoppable threads and wi... by Kiro on Wednesday May 24, 2017 @02:36AM (#14407984)
> The module pattern is pretty well known and you can use it to return a singleton.

How would you even make it _not_ return a singleton? I thought that was default.

Re:Show HN: Nsynjs – JS engine with stoppable threads and wi... by svckr on Wednesday May 24, 2017 @03:35AM (#14408162)
One way is to delete entries from `require.cache`.

Either way you might get a separate instance if npm decided that your module and another module require different version of a given module. These would both be singletons though. Just singletons of instances of different versions of the same module.

Re:Show HN: Nsynjs – JS engine with stoppable threads and wi... by BinaryIdiot on Wednesday May 24, 2017 @01:27PM (#14411763)
It is, I only meant that's a way it can be handled not that it wasn't common or anything.