/
GridTemplate.ts
45 lines (41 loc) · 928 Bytes
/
GridTemplate.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { CarPlay } from '../CarPlay';
import { GridButton } from '../interfaces/GridButton';
import { BaseEvent, Template, TemplateConfig } from './Template';
interface ButtonPressedEvent extends BaseEvent {
/**
* Button ID
*/
id: string;
/**
* Button Index
*/
index: number;
/**
* template ID
*/
templateId: string;
}
export interface GridTemplateConfig extends TemplateConfig {
/**
* The title displayed in the navigation bar while the list template is visible.
*/
title?: string;
/**
* The array of grid buttons displayed on the template.
*/
buttons: GridButton[];
/**
* Fired when a button is pressed
*/
onButtonPressed?(e: ButtonPressedEvent): void;
}
export class GridTemplate extends Template<GridTemplateConfig> {
public get type(): string {
return 'grid';
}
get eventMap() {
return {
gridButtonPressed: 'onButtonPressed',
};
}
}