Sfoglia il codice sorgente

improve the once event

tags/2.4.0
Caven Chen 4 anni fa
parent
commit
216f9cd138
1 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 8
    2
      modules/event/Event.js

+ 8
- 2
modules/event/Event.js Vedi File

@@ -78,8 +78,14 @@ class Event {
* @param context
*/
once(type, callback, context) {
let removeCallback = this._on(type, callback, context)
removeCallback && removeCallback()
let removeCallback = this._on(
type,
e => {
callback(e)
removeCallback && removeCallback()
},
context
)
}

/**

Loading…
Annulla
Salva