私はシングルページアプリケーションでアプリケーションを持っています。 私はまた、登録と外部のログを持っています。クラスとTypescriptの1ページ分のデザインパターン
1.standardシングルトンパターン:
私は私がログインと登録とパスワードの回復のために使用すべきかどうかを知りたいのです。
export class Register {
foo(): any {}
}
2.orかもしれないが、Register.tsなどの "export function foo"のみ?
export function foo: any {}
3またはすべてがモジュールに登録されています。
module Publics {
export module Register {
export function foo(): any {
// ...
}
}
export module Login {
export function foo(): any {
// ...
}
}
}
それは一般的な機能を備えた1ファイルの追加、PublicCommons.tsです...
解決策2。キーワード 'module'を使わないでください。モジュールではなく' namespace'です。 – Paleo