mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-06 13:18:27 +02:00
Prepare for webOS & Tizen support
This commit is contained in:
@@ -9,6 +9,7 @@ type BxButton = {
|
||||
title?: string;
|
||||
disabled?: boolean;
|
||||
onClick?: EventListener;
|
||||
attributes?: {[key: string]: any},
|
||||
}
|
||||
|
||||
type ButtonStyle = {[index: string]: number} & {[index: number]: string};
|
||||
@@ -94,6 +95,12 @@ export const createButton = <T=HTMLButtonElement>(options: BxButton): T => {
|
||||
options.disabled && (($btn as HTMLButtonElement).disabled = true);
|
||||
options.onClick && $btn.addEventListener('click', options.onClick);
|
||||
|
||||
for (const key in options.attributes) {
|
||||
if (!$btn.hasOwnProperty(key)) {
|
||||
$btn.setAttribute(key, options.attributes[key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $btn as T;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user