Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 50bc530

Browse files
committed
perf(build-in-helper.ts*): Added await to the buildIn call.
1 parent 735bb83 commit 50bc530

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

src/core/method/create-build-in-helper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const styleSheetQueue: [string][] = [];
66
let isProcessing = false;
77

88
function createGlobalStyleSheetPromise() {
9-
globalStyleSheetPromise = new Promise<string>((resolve) => {
9+
globalStyleSheetPromise = new Promise<string>(resolve => {
1010
resolveGlobalStyleSheet = (value: string) => {
1111
styleSheetQueue.push([value]);
1212
resolve(value);
@@ -15,7 +15,7 @@ function createGlobalStyleSheetPromise() {
1515
}
1616

1717
async function executeBuildIn(styleSheet: string): Promise<void> {
18-
if (!isDevelopment && styleSheet) buildIn(styleSheet);
18+
if (!isDevelopment && styleSheet) await buildIn(styleSheet);
1919
}
2020

2121
async function processStyleSheets() {

src/core/method/global-build-in-helper.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const styleSheetQueue: [string, string?][] = [];
66
let isProcessing = false;
77

88
function createGlobalStyleSheetPromise() {
9-
globalStyleSheetPromise = new Promise<[string, string?]>((resolve) => {
9+
globalStyleSheetPromise = new Promise<[string, string?]>(resolve => {
1010
resolveGlobalStyleSheet = (value: [string, string?]) => {
1111
styleSheetQueue.push(value);
1212
resolve(value);
@@ -15,10 +15,7 @@ function createGlobalStyleSheetPromise() {
1515
}
1616

1717
async function executeBuildIn(styleSheet: string, option?: string): Promise<void> {
18-
if (!isDevelopment && styleSheet) {
19-
if (option) buildIn(styleSheet, option);
20-
else buildIn(styleSheet);
21-
}
18+
if (!isDevelopment && styleSheet) await buildIn(styleSheet, option);
2219
}
2320

2421
async function processStyleSheets() {

src/core/method/root-build-in-helper.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@ let resolveGlobalStyleSheet: (value: [string, string?]) => void;
44
let globalStyleSheetPromise: Promise<[string, string?]>;
55

66
function createGlobalStyleSheetPromise() {
7-
globalStyleSheetPromise = new Promise<[string, string?]>((resolve) => {
7+
globalStyleSheetPromise = new Promise<[string, string?]>(resolve => {
88
resolveGlobalStyleSheet = resolve;
99
});
1010
}
1111

1212
export async function rootBuildIn(): Promise<void> {
1313
if (typeof globalStyleSheetPromise === 'undefined') createGlobalStyleSheetPromise();
1414
const [styleSheet, option] = await globalStyleSheetPromise;
15-
if (!isDevelopment && styleSheet) {
16-
if (option) buildIn(styleSheet, option);
17-
else buildIn(styleSheet);
18-
}
15+
if (!isDevelopment && styleSheet) await buildIn(styleSheet, option);
1916
createGlobalStyleSheetPromise();
2017
}
2118

src/core/method/set-build-in-helper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const styleSheetQueue: [string][] = [];
66
let isProcessing = false;
77

88
function createGlobalStyleSheetPromise() {
9-
globalStyleSheetPromise = new Promise<string>((resolve) => {
9+
globalStyleSheetPromise = new Promise<string>(resolve => {
1010
resolveGlobalStyleSheet = (value: string) => {
1111
styleSheetQueue.push([value]);
1212
resolve(value);
@@ -15,7 +15,7 @@ function createGlobalStyleSheetPromise() {
1515
}
1616

1717
async function executeBuildIn(styleSheet: string): Promise<void> {
18-
if (!isDevelopment && styleSheet) buildIn(styleSheet);
18+
if (!isDevelopment && styleSheet) await buildIn(styleSheet);
1919
}
2020

2121
async function processStyleSheets() {

0 commit comments

Comments
 (0)