mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: replace detect-browser with ua-parser-js
This commit is contained in:
5 files changed
+18
-13
No files matched your search
@@ -157,6 +157,13 @@ env.addGlobal('set', (obj, key, val) => {
|
||||
env.addGlobal('findSubModule', (prefix) => Object.keys(global.Hydro.ui.template).filter((n) => n.startsWith(prefix)));
|
||||
env.addGlobal('templateExists', (name) => !!global.Hydro.ui.template[name]);
|
||||
|
||||
const supportedPlatformIcons = ['android', 'chromeos', 'ios', 'linux', 'mac', 'mobile', 'windows'];
|
||||
env.addGlobal('platformIcon', (platform) => {
|
||||
const key = platform?.toLowerCase();
|
||||
if (supportedPlatformIcons.includes(key)) return key;
|
||||
return 'unknown';
|
||||
});
|
||||
|
||||
const render = (name: string, state: any) => new Promise<string>((resolve, reject) => {
|
||||
env.render(name, {
|
||||
page_name: name.split('.')[0],
|
||||
|
||||
Reference in new issue
Block a user