Skip to content

Instantly share code, notes, and snippets.

@jcdalton2201
Created November 7, 2019 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcdalton2201/21d467bcb7b8785b0af2aa22dc0b7882 to your computer and use it in GitHub Desktop.
Save jcdalton2201/21d467bcb7b8785b0af2aa22dc0b7882 to your computer and use it in GitHub Desktop.
dynamic import
export class ExternalFiles{
constructor() {
this.getChat();
this.getCalendar();
}
async getChat(){
if(!customElements.get('foo-chat')){
await import('chat/chat.js');
}
}
async getCalendar(){
if(!customElements.get('foo-calendar')){
await import('calendar/calendar.js');
}
}
}
new ExternalFiles();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment