Created
July 23, 2017 06:34
-
-
Save kyuwoo-choi/964d55e9cdaa272de0ec00203584045e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 자바스크립트 컨트롤을 묶을 엘리먼트를 받아와야 한다. | |
constructor(el) { | |
this._el = el; | |
} | |
... | |
// 이 클래스 인스턴스가 `유지하는 엘리먼트`의 innerText | |
this._el.innerText = 'text'; | |
... | |
// 클래스 인스턴스와 엘리먼트의 라이프사이클은 다르다. | |
// bootstrap | |
document.addEventListener('DOMContentLoaded', () => { | |
CurrentTime.create(document.querySelector('.current-time')); | |
}, false); | |
// finalize | |
this._disconnectedObserver = new MutationObserver(mutations => { ... this.dispose() ... }); | |
this._disconnectedObserver.observe(this._el.parentNode, { | |
childList: true | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment