Import events
Fired on <import-element>. They do not bubble.
| Event | When | detail |
|---|---|---|
load |
Every <custom-element> in the file has been defined |
{ url: string } |
error |
The file could not be fetched (non-2xx or network failure) | { url: string, status: number } |
urlis the absolute URL of the file.statusis the HTTP status, or0for a network error.- Neither event fires if the element was removed before the file arrived.
- A failure also logs
Could not import URL (HTTP status).
<import-element from="/components/charts.html" onload="console.log('ready', event.detail.url)" onerror="showFallback(event.detail.status)"></import-element>onload and onerror are native handler attributes, so they work on a plain page too.
See the live example on <import-element>.