Implement downloading and correct MediaShow events in carousel.
This commit is contained in:
+13
-9
@@ -1,4 +1,5 @@
|
||||
import type { BrowseMediaSource, FrigateCardView } from './types.js';
|
||||
import { dispatchFrigateCardEvent } from './common.js';
|
||||
|
||||
export interface ViewParameters {
|
||||
view?: FrigateCardView;
|
||||
@@ -38,18 +39,27 @@ export class View {
|
||||
return !this.isGalleryView();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a view is for the media viewer.
|
||||
*/
|
||||
public isViewerView(): boolean {
|
||||
return ['clip', 'clip-specific', 'snapshot', 'snapshot-specific'].includes(
|
||||
this.view,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a view is related to a clip or clips.
|
||||
*/
|
||||
public isClipRelatedView(): boolean {
|
||||
return ['clip', 'clips'].includes(this.view);
|
||||
return ['clip', 'clips', 'clip-specific'].includes(this.view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a view is related to a snapshot or snapshots.
|
||||
*/
|
||||
public isSnapshotRelatedView(): boolean {
|
||||
return ['snapshot', 'snapshots'].includes(this.view);
|
||||
return ['snapshot', 'snapshots', 'snapshot-specific'].includes(this.view);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,12 +80,6 @@ export class View {
|
||||
* @param node The element dispatching the event.
|
||||
*/
|
||||
public dispatchChangeEvent(node: HTMLElement): void {
|
||||
node.dispatchEvent(
|
||||
new CustomEvent<View>('frigate-card:change-view', {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
detail: this,
|
||||
}),
|
||||
);
|
||||
dispatchFrigateCardEvent(node, 'change-view', this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user