# EuiLoaderService

**Type:** injectable



 A service for loading external dependencies dynamically to the DOM and keeping track of their status. Dependencies
 can be loaded in any order and can have prerequisites. The service will load the prerequisites first and then load
 the dependency. If a dependency fails to load, the service will retry loading it according to the retry policy.
 The service will emit the status of the dependency when it changes. This is useful for showing a loading indicator
 while the dependency is loading. In scenarios where the dependency is not required for the application to function,
 the service will not block the application from loading if the dependency fails to load. The service will also
 remove the dependency from the DOM if it is removed from the list. This is useful for scenarios where the dependency
 is only required for a specific component, might be removed from the list when the component is destroyed, and it
 will not affect the bundle size.

```html
 // Add a dependency
 loader.addDependency('Quill', 'https://cdn.quilljs.com/1.3.6/quill.js', 'js');
 // Get the status of a dependency
 loader.getDependencyStatus('Quill');
 // Listen for status changes
 loader.statusChanges('Quill').subscribe((status: Status) => {
   console.log(status);
 });
 // Remove a dependency
 loader.removeDependency('Quill');
 // Set the retry policy
 loader.setRetryPolicy(3, 1000);
 // Set the timeout policy
 loader.setTimeoutPolicy(5000);
 // Load a dependency with prerequisites
 loader.addDependency('Quill', 'https://cdn.quilljs.com/1.3.6/quill.js', 'js', ['QuillStyle']);
 loader.addDependency('QuillStyle', 'https://cdn.quilljs.com/1.3.6/quill.snow.css', 'css');
 // Load a dependency with prerequisites and retry logic
 loader.setRetryPolicy(3, 1000);
 loader.setTimeoutPolicy(5000);
 loader.addDependency('Quill', 'https://cdn.quilljs.com/1.3.6/quill.js', 'js', ['QuillStyle']);
 loader.addDependency('QuillStyle', 'https://cdn.quilljs.com/1.3.6/quill.snow.css', 'css');
```
