Move patchPollGamepads code to external file

This commit is contained in:
redphx
2024-05-23 06:55:41 +07:00
parent e18e05589a
commit 22e29e1d92
4 changed files with 25 additions and 6 deletions

View File

@@ -61,3 +61,5 @@ export namespace BxEvent {
target.dispatchEvent(event);
}
}
(window as any).BxEvent = BxEvent;

View File

@@ -65,3 +65,15 @@ export function hashCode(str: string): number {
return hash;
}
export function renderString(str: string, obj: any){
return str.replace(/\$\{.+?\}/g, match => {
const key = match.substring(2, match.length - 1);
if (key in obj) {
return obj[key];
}
return match;
});
}