* @function LevelRenderer.Eventful.prototype.bind * @description 绑定事件。 * @param {string} event - 事件名。 * @param {boolean} handler - 响应函数。 * @param {Object} context - context。 * @returns {LevelRenderer.Eventful} this
(event, handler, context)
| 82 | * @returns {LevelRenderer.Eventful} this |
| 83 | */ |
| 84 | bind(event, handler, context) { |
| 85 | var _h = this._handlers; |
| 86 | |
| 87 | if (!handler || !event) { |
| 88 | return this; |
| 89 | } |
| 90 | |
| 91 | if (!_h[event]) { |
| 92 | _h[event] = []; |
| 93 | } |
| 94 | |
| 95 | _h[event].push({ |
| 96 | h: handler, |
| 97 | one: false, |
| 98 | ctx: context || this |
| 99 | }); |
| 100 | |
| 101 | return this; |
| 102 | } |
| 103 | |
| 104 | |
| 105 | /** |
no test coverage detected