Forum Discussion
Issue in adding Library files in tsconfig
This issue may be related to the sandboxing that is done on custom visual and I ran into the same issue myself and while I have a work around I am not sure if there is a better way of doing this.
When you include a custom library its bound to the window and not globally. jQuery for example would be window.jQuery or window.$. Also if you are using TypeScript you will run into the issue that window is strongly type and therefor jQuery will not be available as a property unless you redefine window as any type
public _window : any
_window = window;
_window.jQuery should now work.
- JQuery - 2.2.0
- d3 - 3.5.5
should be loaded by default I assume in their correct name spaces so I dont know if you would need to do the above.
If you are missing the typings for jQuery UI that may also throw errors during build, the documentation should cover how to add typings to the project if they are available, if its a build error that is happening instead of a runtime error?
- Tamil9 years agoFrequent Visitor
Hello gdonnellan,
I debug the visual.js file and all the default files, but I didn't found anything.
Can you please suggest me in which file I need to include this
public _window : any
_window = window;
Thanks in advance,
Tamil
- gdonnellan9 years agoRegular Visitor
Add it in the main plugin .ts where you have implemented the IVisual interface.
In my case I was working with different library from jQuery. it might be different with that one as its a bit of a special case like D3.js when it comes to custom visuals. Your problem may be related to not having the proper typings installed though for jQuery UI if its a compile time problem you are encountering.
export class NetworkVisual implements IVisual {
private _window : any;constructor(options: VisualConstructorOptions) {
this._window = window;
debugger;
// this._window.jQuery should be available
}
}
- Tamil9 years agoFrequent Visitor
Hello gdonnellan,
Can you please provide with a sample screenshot/file for how to import the external library files in typescript .