Javascript : Closure as Class