-
-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(docs): note about reactive options #836
Conversation
@davidjerleke Should we update the Vue example (and others) to use a ref, to demonstrate reactivity? <script setup>
import emblaCarouselVue from 'embla-carousel-vue'
const options = ref({ loop: true })
const [emblaRef] = emblaCarouselVue(options)
// ...
</script> |
@davidjerleke Reading the docs again, and looking at the source code I think we should update the the Vue guide to mention:
Let me know what you think. BTW, is it necessary to run |
@meirroth thanks for your suggestions.
Maybe adding a heading below Global options and name it Reactive options? That section could demonstrate a code example off how to work with reactive options for all reactive Embla wrappers:
I agree. We should add this information on all get started pages
Yes, I agree. Unfortunately the watchEffect examples are sprinkled out so we need to find these places: Events Methods Plugins
function clear(): void {
listeners = {}
} Best, |
@davidjerleke I'll work on all of this once I get the repo running localy.
Can you please clarify what you meant by "it has to be added after this line."
|
Also, trying to understand if |
Thanks a ton!
Very good solution! We should add
Sure! I will do that 👍. Another thing, sorry for changing my mind but I think we should name the heading |
I can look into this as it's a bit hard to exmplain.
The core package 🙂.
Yes they should.
We can under the lifecycle of a carousel add (.on) and remove (.off) listeners but they should be cleared when the carousel is |
@davidjerleke Thank you for your guidance! I've update the title, and added an introduction line to all wrappers. What's left for this PR is the reactive examples. We can continue to discuss removing event listeners here for continuity sake, but I think I'll open a new PR if any changes needed. Surfacing what I wrote earlier: does |
Co-authored-by: David Jerleke <david.jerleke@gmail.com> Co-authored-by: Meir Roth <12494197+meirroth@users.noreply.github.com>
@meirroth fantastic work here. I added the missing examples. Now we only have to update the api/plugins page because plugins are reactive too 😅. But let's do that in a separate PR. About this:
I will create a PR to show you what I mean. Stay tuned 👍. |
@davidjerleke Awesome, thank you! |
@davidjerleke Was this addressed here? 😏 https://github.com/davidjerleke/embla-carousel/pull/871/files#diff-cb6e53e6d149a1a6784922356eaff9e7a5f0a43a0d30203fec752c39b60aeaf0R155 |
@davidjerleke Great work! Thank you |
This PR adds a note mentioning that in some Embla wrappers it's possible to pass reactive options and Embla will automatically reinitialize when they change.