Add picture elements support.

This commit is contained in:
Dermot Duffy
2021-10-07 21:16:16 -07:00
parent 639e2cddfd
commit 49455ab741
14 changed files with 438 additions and 120 deletions
+23
View File
@@ -7,6 +7,7 @@ import type {
BrowseMediaSource,
ExtendedHomeAssistant,
MediaLoadInfo,
Message,
} from './types';
import { browseMediaSourceSchema } from './types';
@@ -144,6 +145,28 @@ export function dispatchMediaLoadEvent(
}
}
export function dispatchMessageEvent(
element: HTMLElement,
message: string,
icon?: string,
): void {
dispatchEvent<Message>(element, 'message', {
message: message,
type: 'info',
icon: icon,
});
}
export function dispatchErrorMessageEvent(
element: HTMLElement,
message: string,
): void {
dispatchEvent<Message>(element, 'message', {
message: message,
type: 'error',
});
}
// Determine whether the card should be updated based on Home Assistant changes.
export function shouldUpdateBasedOnHass(
newHass: HomeAssistant | null,