Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Custom visual external Javascript in PowerBi Desktop Issue

Hi,

We have custom visual component taht needs to use external javascript loaded using the script tag.
Here is an extract from our source code :
private scriptsUrl: string[] = [
"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js",
"https://api.bimsync.com/1.0/js/viewer.js"];


private loadNext = (resolve, reject) =>{
const scriptsUrlElement = this.scriptsUrl[this.loadCount];
let htmlScriptElement = document.createElement('script');
htmlScriptElement.src=scriptsUrlElement;
htmlScriptElement.crossOrigin = "anonymous";
document.body.appendChild(htmlScriptElement);

htmlScriptElement.onload = () => {
console.info("Viewer scripts loaded");
this.loadCount++;
if (this.loadCount >= this.scriptsUrl.length) {
resolve();
}else{
this.loadNext(resolve, reject);
}
};

htmlScriptElement.onerror = (message, url, line, column, error) => {
console.info("Viewer scripts error:" + error);
reject({message,url,line,column,error});
};

}

On web (PowerBi service) it works perfectly but on powerbi desktop we only have an object error (in the onerror) :
{
trusted:true
}

Is there a way to debug this on powerBI desktop or anything we should do ?

Status: New
Comments
v-chuncz-msft
Community Support

@etiskapp 

 

You may take a look at Adding external libraries and visit Custom Visuals Development Discussion for assistance.

etiskapp
New Member

We can't use the "adding external libraries" because the bimsync library can't be added as a node module.

I'll repost it on the Custom Visuals Discussion.