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

Commit a2de1de

Browse files
committed
fix(create and set build-in-helper): Remove executeBuildIn and make it a top-level only async function.
1 parent 4d96e4a commit a2de1de

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,23 @@ 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);
1313
};
1414
});
1515
}
1616

17-
async function executeBuildIn(styleSheet: string): Promise<void> {
18-
if (!isDevelopment && styleSheet) buildIn(styleSheet);
19-
}
20-
21-
async function processStyleSheets() {
17+
function processStyleSheets() {
2218
while (styleSheetQueue.length > 0) {
2319
const [styleSheet] = styleSheetQueue.shift() as [string];
24-
await executeBuildIn(styleSheet);
20+
if (!isDevelopment && styleSheet) buildIn(styleSheet);
2521
}
2622
isProcessing = false;
2723
}
2824

29-
export function createBuildIn(): void {
25+
export async function createBuildIn(): Promise<void> {
3026
if (typeof globalStyleSheetPromise === 'undefined') createGlobalStyleSheetPromise();
3127
if (!isProcessing && styleSheetQueue.length > 0) {
3228
isProcessing = true;

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,23 @@ 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);
1313
};
1414
});
1515
}
1616

17-
async function executeBuildIn(styleSheet: string): Promise<void> {
18-
if (!isDevelopment && styleSheet) buildIn(styleSheet);
19-
}
20-
21-
async function processStyleSheets() {
17+
function processStyleSheets() {
2218
while (styleSheetQueue.length > 0) {
2319
const [styleSheet] = styleSheetQueue.shift() as [string];
24-
await executeBuildIn(styleSheet);
20+
if (!isDevelopment && styleSheet) buildIn(styleSheet);
2521
}
2622
isProcessing = false;
2723
}
2824

29-
export function setBuildIn(): void {
25+
export async function setBuildIn(): Promise<void> {
3026
if (typeof globalStyleSheetPromise === 'undefined') createGlobalStyleSheetPromise();
3127
if (!isProcessing && styleSheetQueue.length > 0) {
3228
isProcessing = true;

0 commit comments

Comments
 (0)