Skip to content

Commit a179a8c

Browse files
authored
Update singleton.md
1 parent b628b81 commit a179a8c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/tips/singleton.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,16 @@ Singleton.someMethod();
3535
```
3636

3737
> Warning : Singleton is just a fancy name for [global](http://stackoverflow.com/a/142450/390330)
38+
39+
For most projects `namespace` can additional be replaced by a *module*.
40+
41+
```ts
42+
// someFile.ts
43+
// ... any one time initialization goes here ...
44+
export function someMethod() { }
45+
46+
// Usage
47+
import {someMethod} from "./someFile";
48+
```
49+
50+

0 commit comments

Comments
 (0)