add Artplayer.LOG_VERSION

This commit is contained in:
Harvey Zack committed 2023-08-22 20:51:39 +08:00
1 parent 3179d1241e
commit 894a9db1d7
34 files changed
+182 -136

No files matched your search

+4 -4
View File
@@ -1,7 +1,7 @@
export default class Emitter {
on(name, fn, ctx) {
const e = this.e || (this.e = {});
(e[name] || (e[name] = [])).push({ fn, ctx });
const e = this.e ?? (this.e = {});
(e[name] ?? (e[name] = [])).push({ fn, ctx });
return this;
}
@@ -16,7 +16,7 @@ export default class Emitter {
}
emit(name, ...data) {
const evtArr = ((this.e || (this.e = {}))[name] || []).slice();
const evtArr = ((this.e ?? (this.e = {}))[name] ?? []).slice();
for (let i = 0; i < evtArr.length; i += 1) {
evtArr[i].fn.apply(evtArr[i].ctx, data);
}
@@ -24,7 +24,7 @@ export default class Emitter {
}
off(name, callback) {
const e = this.e || (this.e = {});
const e = this.e ?? (this.e = {});
const evts = e[name];
const liveEvents = [];
if (evts && callback) {