Hello!
Is there any way to use custom library that would be accessible from all widgets in Experience Builder? I'd imagine something similar to folder /libs in Web AppBuilder.
Thanks,
Matěj.
There is a "dependency" property in widget manifest.json, you can put your lib url here. The dependent lib will be loaded before when widget start load.
Thanks for the reply. Unfortunately, I don't think that solves my issue.
Let's say I want use this simple custom library:
export default class TestLib {
constructor() {}
private static _instance: TestLib;
private _list: __esri.Graphic[] = [];
public get list(): __esri.Graphic[] {
return this._list;
}
public append(item: __esri.Graphic): void {
this._list.push(item);
}
public static getInstance(): TestLib {
if (!this._instance)
this._instance = new TestLib();
return this._instance;
}
}
In Web AppBuilder all I need to do is place the file in the /libs folder, and access it from widgets using:
import testLib from "libs/testLib"
I there some similar way in Experience Builder?
Thanks.
I assume you are using a third party lib, so you can just load the lib by using a CDN URL like https://abc.com/...., or you can download the lib and put it in the app and load it by using “lib/abc.js”. However, if you are using your own lib, this is a little complex because you need to build your lib as an entry using webpack first before you can load it.
发件人: Matej Kutik <geonet@esri.com>
发送时间: 2020年4月10日 21:37
收件人: Junshan Liu <junshan_liu@esri.com>
主题: Re: - Re: Custom libraries
GeoNet, The Esri Community | GIS and Geospatial Professional Community <https://community.esri.com/?et=watches.email.thread>
Re: Custom libraries
reply from Matej Kutik<https://community.esri.com/people/kutikmatej?et=watches.email.thread> in ArcGIS Experience Builder - View the full discussion<https://community.esri.com/message/921471-re-custom-libraries?commentID=921471&et=watches.email.thread#comment-921471>