UsingjQuery.sap.includeScript().then() in HCP Firori Launchpad

允我心安 提交于 2019-11-29 17:28:38

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

Looks like the InterceptService doesn't support the newest signature of jQuery.sap.includeScript (where parameters are provided in a configuration object instead of as individual arguments) yet.

Midterm, the InterceptService needs to be enhanced / fixed. Short-term, you might fall back to the old signature jQuery.sap.includeScript(url, id, onload, onerror). There is unfortunately no way to get a Promise with the old signature.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!