jQuery.sap.includeScript().then() not working in SCP SAPUI5 app

后端 未结 2 1731
孤城傲影
孤城傲影 2020-12-22 02:14

I\'m trying to include googlemaps in sapui5

jQuery.sap.includeScript({
                url: \"https://maps.googleapis.com/maps/api/js?key=XXXX\",
                   


        
2条回答
  •  旧时难觅i
    2020-12-22 02:45

    It is indeed issue of InterceptorService, which does not support the syntax of includeScript with object as first argument.

    I've forwarded a code of the solution to implementation team of HCP Portal Service and it will be fixed in the next release.

    So far, you can achieve the same functionality with the following workaround:

    new Promise(function(fnResolve, fnReject) {
        jQuery.sap.includeScript(
            "https://maps.googleapis.com/maps/api/js?key=XXXX", 
            "mapsScriptId", fnResolve, fnReject
        );
    }).then(function() { ... } )
    

    See how UI5 implements it: https://github.com/SAP/openui5/blob/rel-1.38/src/sap.ui.core/src/jquery.sap.global.js#L4387-L4389

提交回复
热议问题