Skip to content

Commit 9a997e7

Browse files
committed
2020.11.16
1 parent f192400 commit 9a997e7

4 files changed

Lines changed: 19 additions & 4 deletions

File tree

Cute-Gist/IoC/ArticlesDemo/level-1.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// Level-1 直接实现
1+
/**
2+
* Level-1 直接实现
3+
*
4+
* 在主类中的构造函数,实例化每个子类。
5+
*/
26

37
class Bed {
48
constructor(){

Cute-Gist/IoC/ArticlesDemo/level-2.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// Level-2 简单抽取通用配置
1+
/**
2+
* Level-2 简单抽取通用配置
3+
*
4+
* 在主类中的构造函数,接收每个子类实例化后结果作为参数。
5+
*/
26

37
class Bed {
48
constructor(){

Cute-Gist/IoC/ArticlesDemo/level-3.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
// Level-3 使用简单 DI
1+
/**
2+
* Level-3 使用简单 DI
3+
*
4+
* 将实例化后子类作为新对象的属性,通过使用主类中的静态属性 use,来注入主类。
5+
*/
6+
27
class Bed {
38
constructor(){
49
console.log("This is a bed!")

Cute-Gist/IoC/ArticlesDemo/level-4.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// Level-4 拓展 DI
1+
/**
2+
* Level-4 拓展 DI
3+
*/
24

35
class Bed {
46
constructor(){

0 commit comments

Comments
 (0)