1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-25 05:06:18 +00:00
Files
frontend/src/polymer-types.ts

39 lines
728 B
TypeScript

export const applyPolymerEvent = <T>(
ev: PolymerChangedEvent<T>,
curValue: T
): T => {
const { path, value } = ev.detail;
if (!path) {
return value;
}
const propName = path.split(".")[1];
return { ...curValue, [propName]: value };
};
export interface PolymerChangedEvent<T> extends Event {
detail: {
value: T;
path?: string;
queueProperty: boolean;
};
}
export interface PolymerIronSelectEvent<T> extends Event {
detail: {
item: T;
};
}
declare global {
// for fire event
interface HASSDomEvents {
"hass-logout": undefined;
"iron-resize": undefined;
"config-refresh": undefined;
"hass-api-called": {
success: boolean;
response: unknown;
};
}
}