import { loadStyle, loadScript } from 'lightning/platformResourceLoader';
// static resource
import myResourceName from '@salesforce/resourceUrl/myResourceName';
initianlized = false;
Use in renderedCallback() {
if (this.initianlized) {
return;
}
this.initianlized = true;
Promise.all([
loadStyle(this, myResourceName + '/css/myResourceName.css'),
loadScript(this, myResourceName + '/js/myResourceName.js'),
]).then(() => {
// do some thing
});
}
myResourceName zip
/js/myResourceName.js
/css/myResourceName.css
No comments:
Post a Comment