* Adds the observer to this instance. * @param {function(TYPE=):void} handler Observer's handler. * @return {import('#core/types/function/types').UnlistenCallback}
(handler)
| 20 | * @return {import('#core/types/function/types').UnlistenCallback} |
| 21 | */ |
| 22 | add(handler) { |
| 23 | if (!this.handlers_) { |
| 24 | this.handlers_ = []; |
| 25 | } |
| 26 | this.handlers_.push(handler); |
| 27 | return () => { |
| 28 | this.remove(handler); |
| 29 | }; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Removes the observer from this instance. |
no test coverage detected