jeudi 5 octobre 2017

Design pattern for one page in Typescript

I have an application in single page application. I have also registration and logging outside.

I'd like to know if i should use for login and registration and password recovery:

1.standard singleton pattern with class.

export class Register {
    foo(): any {}
}

2.or maybe only "export function foo" in Register.ts etc..?

export function foo: any {}

3.or everything keep in module Registration, module Login?

module Publics {
    export module Register {
        export function foo(): any {
            // ...            
        }
    }
    export module Login {
        export function foo(): any {
            // ...            
        }
    }
}

It is 1 file additional, PublicCommons.ts with common functions...

Aucun commentaire:

Enregistrer un commentaire