Thursday, April 16, 2026

Dynamic Import in Javascript

 

Dynamic Imports
If you need to load a function conditionally or on-demand (e.g., inside an if block or an event listener), use the import() function. This returns a Promise.

// Using .then()
import('./myFile.js').then((module) => {
  module.myFunction();
});

// Using async/await
const module = await import('./myFile.js');
module.myFunction();

No comments:

Post a Comment

JOURNY - 003

 1. Agent with manual similarity search ( no vector db right now, later we will go for in-memory FAISS) 2. Smart chunking implemented before...