-
Notifications
You must be signed in to change notification settings - Fork 46
Closed
Description
Hi,
I tried to render an interactive svg with the following code
the issue : it loops (n loaded on console, blinking on screen).
Thank you.
I can write a code pen if needed.
const dispatch=(id, detail)=>()=>document.dispatchEvent(new CustomEvent(id, {detail:detail}))
const svg_test=(id,path)=> html`
<object
type="image/svg+xml"
.data=${path}
onload=${dispatch(id)}
</object>
`;
const m= {
id:'_svg_',
path:'a valid path'
}
const update=()=> {
render(document.body, svg_test(m.id, m.path));
}
document.addEventListener(m.id, ()=> {
console.log("loaded");
// do some work here like changing the svgs height/scale
update();
});
update();
Metadata
Metadata
Assignees
Labels
No labels