Skip to content

Commit 8bfaf5c

Browse files
docs: remove replaced content from old documentation
1 parent 7a1d932 commit 8bfaf5c

File tree

2 files changed

+2
-84
lines changed

2 files changed

+2
-84
lines changed

docs/README.md

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,7 @@
11
# Documentation
22

3-
TypeDI is a [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) tool for JavaScript and TypeScript.
4-
Using TypeDI you can build well-structured and easily tested applications.
5-
63
## Typescript Usage
74

8-
You can use **property injection** and inject services into your class using `@Inject` decorator:
9-
10-
```typescript
11-
import { Container, Inject, Service } from 'typedi';
12-
13-
@Service()
14-
class BeanFactory {
15-
create() {}
16-
}
17-
18-
@Service()
19-
class SugarFactory {
20-
create() {}
21-
}
22-
23-
@Service()
24-
class WaterFactory {
25-
create() {}
26-
}
27-
28-
@Service()
29-
class CoffeeMaker {
30-
@Inject()
31-
beanFactory: BeanFactory;
32-
33-
@Inject()
34-
sugarFactory: SugarFactory;
35-
36-
@Inject()
37-
waterFactory: WaterFactory;
38-
39-
make() {
40-
this.beanFactory.create();
41-
this.sugarFactory.create();
42-
this.waterFactory.create();
43-
}
44-
}
45-
46-
let coffeeMaker = Container.get(CoffeeMaker);
47-
coffeeMaker.make();
48-
```
49-
50-
You can also use a constructor injection:
51-
52-
```typescript
53-
import { Container, Service } from 'typedi';
54-
55-
@Service()
56-
class BeanFactory {
57-
create() {}
58-
}
59-
60-
@Service()
61-
class SugarFactory {
62-
create() {}
63-
}
64-
65-
@Service()
66-
class WaterFactory {
67-
create() {}
68-
}
69-
70-
@Service()
71-
class CoffeeMaker {
72-
constructor(
73-
private beanFactory: BeanFactory,
74-
private sugarFactory: SugarFactory,
75-
private waterFactory: WaterFactory
76-
) {}
77-
78-
make() {
79-
this.beanFactory.create();
80-
this.sugarFactory.create();
81-
this.waterFactory.create();
82-
}
83-
}
84-
85-
let coffeeMaker = Container.get(CoffeeMaker);
86-
coffeeMaker.make();
87-
```
88-
895
With TypeDI you can use a named services. Example:
906

917
```typescript

docs/typescript/01-getting-started.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Getting Started
22

3+
TypeDI is a [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) library for TypeScript and JavaScript.
4+
35
## Installation
46

57
> Note: This installation guide is for usage with TypeScript, if you wish to use TypeDI without Typescript

0 commit comments

Comments
 (0)