export const loadSdk = () => {
    return new Promise((resolve) => {
        // const srcList: any = ['https://static.bimface.com/api/BimfaceSDKLoader/BimfaceSDKLoader@latest-release.js']
        const srcList: any = ['/bf/static/api/JSHostConfig.js',
            '/bf/static/api/BimfaceSDKLoader/BimfaceSDKLoader@latest-release.js']
        srcList.forEach((item: any) => {
        const script = document.createElement('script')
        script.setAttribute('src', item)
        script.setAttribute('type', 'module')
        script.onload = () => {
            return resolve(true)
        }
        document.body.append(script)
        })
    })
}
export interface MapOptions {
    hasLoadSDK: boolean,
}
export const initMap = async() => {
    const opts: MapOptions = {
        hasLoadSDK: window.hasLoadSDK
    }
    if (!opts.hasLoadSDK) {
        await loadSdk()
        window.hasLoadSDK = true
    }
}