* @function LevelRenderer.Eventful.prototype.one * @description 单次触发绑定,dispatch后销毁。 * @param {string} event - 事件名。 * @param {boolean} handler - 响应函数。 * @param {Object} context - context。 * @returns {LevelRenderer.Eventful} this
(event, handler, context)
| 53 | * @returns {LevelRenderer.Eventful} this |
| 54 | */ |
| 55 | one(event, handler, context) { |
| 56 | var _h = this._handlers; |
| 57 | |
| 58 | if (!handler || !event) { |
| 59 | return this; |
| 60 | } |
| 61 | |
| 62 | if (!_h[event]) { |
| 63 | _h[event] = []; |
| 64 | } |
| 65 | |
| 66 | _h[event].push({ |
| 67 | h: handler, |
| 68 | one: true, |
| 69 | ctx: context || this |
| 70 | }); |
| 71 | |
| 72 | return this; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | /** |