2024-03-27 17:28:53 +08:00

38 lines
920 B
TypeScript

// interface UtilsMetadata {
// name: string;
// npm: {
// package: string;
// version?: string;
// exportName: string;
// subName?: string;
// destructuring?: boolean;
// main?: string;
// };
// }
// invalid code
// interface LibrayMap {
// [key: string]: string;
// }
// export function getProjectUtils(librayMap: LibrayMap, utilsMetadata: UtilsMetadata[]) {
// const projectUtils: { [packageName: string]: any } = {};
// if (utilsMetadata) {
// utilsMetadata.forEach(meta => {
// if (librayMap[meta?.npm.package]) {
// const lib = window[librayMap[meta?.npm.package] as any];
// }
// });
// }
// }
/**
* judges if current simulator renderer deteched or not
* @returns detached or not
*/
export function isRendererDetached() {
// if current iframe detached from host document, the `window.parent` will be undefined.
return !window.parent;
}