Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save RatanPaul/70f2284eedbd09a04e9462a5e685b3d0 to your computer and use it in GitHub Desktop.
Save RatanPaul/70f2284eedbd09a04e9462a5e685b3d0 to your computer and use it in GitHub Desktop.
import { LightningElement } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { loadScript, loadStyle } from 'lightning/platformResourceLoader';
import ChatResource from '@salesforce/resourceUrl/Chat_Application_LWC';
export default class Chat_Application extends LightningElement {
renderedCallback() {
Promise.all([
loadScript(this, ChatResource + '/js/jquery.min.js'),
loadScript(this, ChatResource + '/js/jquery.mCustomScrollbar.min.js'),
loadScript(this, ChatResource + '/js/bootstrap.min.js'),
loadStyle(this, ChatResource + '/css/jquery.mCustomScrollbar.min.css'),
loadStyle(this, ChatResource + '/css/bootstrap.min.css'),
loadStyle(this, ChatResource + '/css/all.css')
]).then(() => {
this.dispatchEvent(
new ShowToastEvent({
title: 'Success loading Files',
message: 'Successfully loaded JS and CSS',
variant: 'Success'
})
);
})
.catch(error => {
this.dispatchEvent(
new ShowToastEvent({
title: 'Error loading Files',
message: error.message,
variant: 'error'
})
);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment