style(player):rm unused;rename few vars
This commit is contained in:
parent
6fb85aaa2b
commit
3588eddfd3
3 changed files with 5 additions and 26 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import type { Timed } from './types';
|
||||
|
||||
export default class ListWalker<T extends Timed> {
|
||||
private p = 0
|
||||
private p = 0 /* Pointer to the "current" item */
|
||||
constructor(private _list: Array<T> = []) {}
|
||||
|
||||
append(m: T): void {
|
||||
|
|
@ -130,7 +130,7 @@ export default class ListWalker<T extends Timed> {
|
|||
return changed ? this.list[ this.p - 1 ] : null;
|
||||
}
|
||||
|
||||
moveApply(t: number, fn: (msg: T) => void, fnBack?: (msg: T) => void): void {
|
||||
async moveWait(t: number, callback: (msg: T) => Promise<any> | undefined): Promise<void> {
|
||||
// Applying only in increment order for now
|
||||
if (t < this.timeNow) {
|
||||
this.reset();
|
||||
|
|
@ -138,23 +138,8 @@ export default class ListWalker<T extends Timed> {
|
|||
|
||||
const list = this.list
|
||||
while (list[this.p] && list[this.p].time <= t) {
|
||||
fn(this.moveNext())
|
||||
}
|
||||
while (fnBack && this.p > 0 && list[ this.p - 1 ].time > t) {
|
||||
fnBack(this.movePrev());
|
||||
}
|
||||
}
|
||||
|
||||
async moveWait(t: number, fn: (msg: T) => Promise<any> | undefined): Promise<void> {
|
||||
// Applying only in increment order for now
|
||||
if (t < this.timeNow) {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
const list = this.list
|
||||
while (list[this.p] && list[this.p].time <= t) {
|
||||
const ret = fn(this.list[ this.p++ ]);
|
||||
if (ret) { await ret }
|
||||
const maybePromise = callback(this.list[ this.p++ ]);
|
||||
if (maybePromise) { await maybePromise }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ export default class DOMManager extends ListWalker<Message> {
|
|||
private readonly vTexts: Map<number, VText> = new Map() // map vs object here?
|
||||
private readonly vElements: Map<number, VElement> = new Map()
|
||||
private readonly vRoots: Map<number, VShadowRoot | VDocument> = new Map()
|
||||
private activeIframeRoots: Map<number, number> = new Map()
|
||||
private styleSheets: Map<number, CSSStyleSheet> = new Map()
|
||||
private ppStyleSheets: Map<number, PostponedStyleSheet> = new Map()
|
||||
private stringDict: Record<number,string> = {}
|
||||
|
|
@ -197,7 +196,6 @@ export default class DOMManager extends ListWalker<Message> {
|
|||
// todo: start from 0-node (sync logic with tracker)
|
||||
this.vTexts.clear()
|
||||
this.stylesManager.reset()
|
||||
this.activeIframeRoots.clear()
|
||||
this.stringDict = {}
|
||||
return
|
||||
case MType.CreateTextNode:
|
||||
|
|
@ -333,12 +331,8 @@ export default class DOMManager extends ListWalker<Message> {
|
|||
logger.warn("No default iframe doc", msg, host)
|
||||
return
|
||||
}
|
||||
// remove old root of the same iframe if present
|
||||
const oldRootId = this.activeIframeRoots.get(msg.frameID)
|
||||
oldRootId != null && this.vRoots.delete(oldRootId)
|
||||
|
||||
const vDoc = new VDocument(doc)
|
||||
this.activeIframeRoots.set(msg.frameID, msg.id)
|
||||
this.vRoots.set(msg.id, vDoc)
|
||||
return;
|
||||
} else if (host instanceof Element) { // shadow DOM
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ export class VStyleElement extends VElement {
|
|||
this.stylesheetCallbacks = []
|
||||
} else {
|
||||
// console.warn("Style onload: sheet is null") ?
|
||||
// sometimes logs shit ton of errors for some reason
|
||||
// sometimes logs sheet ton of errors for some reason
|
||||
}
|
||||
this.loaded = true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue