728x90
반응형
class ExamClass {
constructor() {
...
this.init();
}
init() {
this.A = new constructorA(this.B);
this.B = new constructorB(this.A);
this.C = new constructorC(this.A, this.B);
}
}
위처럼 A는 A를 생성하기 위해 B가 필요하고, B는 B를 생성하기 위해 A가 필요하는 상황이였습니다.
그 때는 ExamClass를 사용하여 해결하였습니다.
class ExamClass {
constructor() {
...
this.init();
}
init() {
this.A = new constructorA(this);
this.B = new constructorB(this.A);
this.C = new constructorC(this.A, this.B);
}
}
728x90
반응형
'프로그래밍(Web) > 업무관련' 카테고리의 다른 글
[바미] Ajax data 주의 사항. (0) | 2022.05.18 |
---|---|
[바미] Header 관련한 삽질기 (0) | 2022.04.27 |
[바미] 이벤트 버블링 (Feat. 너는 움직이면 안돼지..) (0) | 2022.03.30 |
[바미] 메모리 릭(memory leak)현상을 마주하다. (0) | 2022.03.28 |
[바미] 백오피스를 고민하다 (0) | 2022.02.10 |