Show debug info

This commit is contained in:
redphx
2024-07-18 20:47:58 +07:00
parent 1f3e4b8250
commit 5b4088cc81
4 changed files with 77 additions and 2 deletions

View File

@@ -11,6 +11,11 @@ type BxFlags = Partial<{
FeatureGates: {[key: string]: boolean} | null,
IsSupportedTvBrowser: boolean,
DeviceInfo: Partial<{
deviceType: 'android' | 'android-tv' | 'webos' | 'unknown',
userAgent: string,
}>,
}>
// Setup flags
@@ -25,6 +30,11 @@ const DEFAULT_FLAGS: BxFlags = {
ForceNativeMkbTitles: [],
FeatureGates: null,
DeviceInfo: {
deviceType: 'unknown',
userAgent: window.navigator.userAgent,
},
}
export const BX_FLAGS: BxFlags = Object.assign(DEFAULT_FLAGS, window.BX_FLAGS || {});

View File

@@ -35,7 +35,13 @@ function createElement<T=HTMLElement>(elmName: string, props: {[index: string]:
if (hasNs) {
$elm.setAttributeNS(null, key, props[key]);
} else {
$elm.setAttribute(key, props[key]);
if (key === 'on') {
for (const eventName in props[key]) {
$elm.addEventListener(eventName, props[key][eventName]);
}
} else {
$elm.setAttribute(key, props[key]);
}
}
}