@tencentcloud/roomkit-web-vue3
Version:
<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,
47 lines (38 loc) • 1.14 kB
text/typescript
import { getUrlParam } from './utils';
const THEME = {
LIGHT: 'light',
DARK: 'dark',
};
type ThemeOption = 'LIGHT' | 'DARK';
/**
* Get Language
* @returns language
*/
export function getLanguage() {
const isWxMiniProgram = typeof wx !== 'undefined' && wx.getSystemInfoSync;
let language =
getUrlParam('lang') ||
navigator.language ||
(isWxMiniProgram ? 'zh-CN' : 'en-US');
language = language.replace(/_/, '-').toLowerCase();
const isZh = language.startsWith('zh');
language = isZh ? 'zh-CN' : 'en-US';
return language;
}
/**
* Determine if a string is a number
* @returns boolean
*/
export function checkNumber(roomId: string) {
const reg = /^\d+$/;
return reg.test(roomId);
}
export function toTargetTheme(themeOption: ThemeOption) {
const theme = themeOption === 'DARK' ? THEME.DARK : THEME.LIGHT;
return theme;
}
// RoomKit schedule conference passwords restricted to digital checksums
export const invalidDigitalPasswordRegex = /[^\d]+/g;
// RoomKit enter room Password legitimacy verification
export const invalidPasswordRegex =
/[^A-Za-z0-9!@#$%^&*()_+{}|:"<>?`~';[\]\\/.,-=]+/g;