Skip to content

Commit

Permalink
Merge pull request #667 from 3flex/remove-setBackdropPeriodMs
Browse files Browse the repository at this point in the history
Remove unused function setBackdropPeriodMs
  • Loading branch information
nielsvanvelzen authored Nov 3, 2024
2 parents cfa3de8 + ea7f0c0 commit c36bc05
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions src/components/documentManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DeviceIds, getActiveDeviceId } from './castDevices';
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export abstract class DocumentManager {
// Duration between each backdrop switch in ms
private static backdropPeriodMs: number | null = 30000;
private static backdropPeriodMs = 30000;
// Timer state - so that we don't start the interval more than necessary
private static backdropTimer: number | null = null;

Expand Down Expand Up @@ -404,13 +404,6 @@ export abstract class DocumentManager {
// avoid running it multiple times
this.clearBackdropInterval();

// skip out if it's disabled
if (!this.backdropPeriodMs) {
this.setWaitingBackdrop(null, null);

return;
}

this.backdropTimer = window.setInterval(
() => DocumentManager.setRandomUserBackdrop(),
this.backdropPeriodMs
Expand All @@ -419,28 +412,6 @@ export abstract class DocumentManager {
await this.setRandomUserBackdrop();
}

/**
* Set interval between backdrop changes, null to disable
* @param period - in milliseconds or null
*/
public static setBackdropPeriodMs(period: number | null): void {
if (period !== this.backdropPeriodMs) {
this.backdropPeriodMs = period;

// If the timer was running, restart it
if (this.backdropTimer !== null) {
// startBackdropInterval will also clear the previous one
this.startBackdropInterval();
}

if (period === null) {
// No backdrop is wanted, and the timer has been cleared.
// This call will remove any present backdrop.
this.setWaitingBackdrop(null, null);
}
}
}

/**
* Set background behind the media player,
* this is shown while the media is loading.
Expand Down

0 comments on commit c36bc05

Please sign in to comment.