JavaScript design patterns: singleton