refactor(core): zero circulars + esm ready (#10770)

This commit is contained in:
Nathan Walker
2025-09-18 17:03:23 -07:00
committed by GitHub
parent 1e54baf198
commit c2ff8c1ae7
306 changed files with 9136 additions and 9889 deletions

View File

@ -1,7 +1,9 @@
import { Trace } from '../trace';
import { ios as iOSUtils } from './native-helper';
import { ios as iOSUtils, isRealDevice } from './native-helper';
import { debounce, throttle } from './shared';
export { clearInterval, clearTimeout, setInterval, setTimeout } from '../timer';
export * from './animation-helpers';
export * from './common';
export * from './constants';
export * from './debug';
@ -9,12 +11,14 @@ export * from './layout-helper';
export * from './macrotask-scheduler';
export * from './mainthread-helper';
export * from './native-helper';
export * from './shared';
export * from './types';
export * from './native-helper';
export function openFile(filePath: string): boolean {
try {
const appPath = iOSUtils.getCurrentAppPath();
const path = iOSUtils.isRealDevice() ? filePath.replace('~', appPath) : filePath;
const path = isRealDevice() ? filePath.replace('~', appPath) : filePath;
const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path));
controller.delegate = iOSUtils.createUIDocumentInteractionControllerDelegate();
@ -31,6 +35,39 @@ export function GC() {
__collect();
}
let throttledGC: Map<number, () => void>;
let debouncedGC: Map<number, () => void>;
export function queueGC(delay = 900, useThrottle?: boolean) {
/**
* developers can use different queueGC settings to optimize their own apps
* each setting is stored in a Map to reuse each time app calls it
*/
if (useThrottle) {
if (!throttledGC) {
throttledGC = new Map();
}
if (!throttledGC.get(delay)) {
throttledGC.set(
delay,
throttle(() => GC(), delay),
);
}
throttledGC.get(delay)();
} else {
if (!debouncedGC) {
debouncedGC = new Map();
}
if (!debouncedGC.get(delay)) {
debouncedGC.set(
delay,
debounce(() => GC(), delay),
);
}
debouncedGC.get(delay)();
}
}
export function releaseNativeObject(object: NSObject) {
__releaseNativeCounterpart(object);
}
@ -69,10 +106,6 @@ export function openUrlAsync(location: string): Promise<boolean> {
});
}
export function isRealDevice(): boolean {
return iOSUtils.isRealDevice();
}
export const ad = 0;
export function dismissSoftInput(nativeView?: UIView): void {