beyonk-group / svelte-carousel

A super lightweight, super simple Carousel for Svelte 3
MIT License
213 stars 38 forks source link

(Re)initalize carousel in runtime #46

Closed kovapatrik closed 4 years ago

kovapatrik commented 4 years ago

I wanted to change the content of the carousel in runtime, but this isn't possible at the moment if I'm right. I tried to modify the code, but it didn't work.

Is this possible at all without rewriting the code?

antony commented 4 years ago

If Siema supports it, there is no reason it couldn't be done. However I don't know if Siema supports it.

Right now we pass the container to Siema during onMount so it isn't watched / updatable

However there is no issue adding an addPage or removePage method if Siema can reconfigure itself at runtime.

kovapatrik commented 4 years ago

Hm, I'm not into Siema but I will check on it.

Btw I thought something like this:

  1. Component is created in html section and a variable is binded to it
  2. Some DOM element added to the component in the script at runtime
  3. Fire initalize function
  4. If you want to reinitalize, there will be a destroy function, and then you can initalize again

So it doesn't necessary that Siema supports reconfiguration if I get it right.

What do you think, is this possible to code?

kovapatrik commented 4 years ago

At last I solved it an other way. I used pure siema, and then I could destroy and reinitalize the object at runtime.