Refactor media info handling into a controller.

This commit is contained in:
Dermot Duffy
2023-05-21 09:29:13 -07:00
parent 560c90dda1
commit 8658cc500f
5 changed files with 296 additions and 41 deletions
+27
View File
@@ -0,0 +1,27 @@
import { MediaLoadedInfo } from '../types';
export class MediaLoadedInfoController {
protected _current: MediaLoadedInfo | null = null;
protected _lastKnown: MediaLoadedInfo | null = null;
public set(current: MediaLoadedInfo): void {
this._current = current;
this._lastKnown = current;
}
public get(): MediaLoadedInfo | null {
return this._current;
}
public getLastKnown(): MediaLoadedInfo | null {
return this._lastKnown;
}
public clear(): void {
this._current = null;
}
public has(): boolean {
return !!this._current;
}
}