@nplayer/danmaku@1.0.9 addItem()
Opened this issue · 1 comments
wenzhenhao commented
Describe the bug
There is the source code that I found:
addItem(opts: BulletOption): number {
if (opts.time == null) return -1;
let index = 0;
for (let i = 0, l = this.items.length; i < l; i++) {
if (this.items[i].time > opts.time) {
index = i;
break;
}
}
this.items.splice(index, 0, opts);
return index;
}
I think the initial value of 'index' should be 'this.items.length'.
Cause if opts.time > Math.max(...(this.items.map(item => item.time)))
opts should be the last of this.items, not the first one!
If you see this, please correct it
@nplayer/danmaku@1.0.9