ui: speed up page load

This commit is contained in:
undefined committed 2023-03-13 04:25:44 +08:00
1 parent cb741b346c
commit 67279c3745
15 files changed
+80 -106

No files matched your search

+3
View File
@@ -1,5 +1,7 @@
import $ from 'jquery';
import _ from 'lodash';
import React from 'react';
import DOMServer from 'react-dom/server.browser';
export function substitute(str: string, obj: any) {
return str.replace(/\{([^{}]+)\}/g, (match, key) => {
@@ -32,6 +34,7 @@ export function secureRandomString(digit = 32, dict = defaultDict) {
type Substitution = string | number | { templateRaw: true, html: string };
export function tpl(pieces: TemplateStringsArray, ...substitutions: Substitution[]) {
if (React.isValidElement(pieces)) return DOMServer.renderToStaticMarkup(pieces);
let result = pieces[0];
for (let i = 0; i < substitutions.length; ++i) {
const subst = substitutions[i];