* Initializes the mutation observer and observable.
()
| 60 | * Initializes the mutation observer and observable. |
| 61 | */ |
| 62 | init_() { |
| 63 | if (this.mutationObserver_) { |
| 64 | return; |
| 65 | } |
| 66 | this.observable_ = new Observable(); |
| 67 | |
| 68 | const mo = new this.win_.MutationObserver((mutations) => { |
| 69 | if (mutations) { |
| 70 | this.observable_.fire(mutations); |
| 71 | } |
| 72 | }); |
| 73 | this.mutationObserver_ = mo; |
| 74 | mo.observe(this.root_, OBSERVER_OPTIONS); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Cleans up the all the mutation observer once the last listener stops |