Discussion:
[elm-discuss] Embedding the same view multiple times on a page
Anthony Naddeo
2017-08-15 18:14:17 UTC
Permalink
Does anyone have any pointers for how to repeatedly embed an Elm view on a
page, particularly from JS? The use case would be for some type of embedded
widget that people can insert into their page where each instance would
correspond to a different id of some type. Imagine a widget that embeds
live updating twitter feeds for different users where web page owners would
be able to create buttons that launch live update windows.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Peter Damoc
2017-08-15 20:09:16 UTC
Permalink
What have you tried and what problems did you encountered?

Here are 3 counters embedded in the same page with different info passed
through flags.
https://ellie-app.com/439PSrgx4dxa1/1

Why wouldn't something like this work?
Post by Anthony Naddeo
Does anyone have any pointers for how to repeatedly embed an Elm view on a
page, particularly from JS? The use case would be for some type of embedded
widget that people can insert into their page where each instance would
correspond to a different id of some type. Imagine a widget that embeds
live updating twitter feeds for different users where web page owners would
be able to create buttons that launch live update windows.
--
You received this message because you are subscribed to the Google Groups
"Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
There is NO FATE, we are the creators.
blog: http://damoc.ro/
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Anthony Naddeo
2017-08-15 20:21:03 UTC
Permalink
That's actually very close to what I tried, I'm not sure what I was doing
wrong. I might have left some assumptions in about how many would be on the
page, but I wasn't getting any rendering.

Assuming I get that to work, what does embed actually do? Is each instance
totally isolated? Does the elm runtime bootstrap itself each time? To share
state, we'll have to use ports?
Post by Peter Damoc
What have you tried and what problems did you encountered?
Here are 3 counters embedded in the same page with different info passed
through flags.
https://ellie-app.com/439PSrgx4dxa1/1
Why wouldn't something like this work?
Post by Anthony Naddeo
Does anyone have any pointers for how to repeatedly embed an Elm view on
a page, particularly from JS? The use case would be for some type of
embedded widget that people can insert into their page where each instance
would correspond to a different id of some type. Imagine a widget that
embeds live updating twitter feeds for different users where web page
owners would be able to create buttons that launch live update windows.
--
Post by Anthony Naddeo
You received this message because you are subscribed to the Google Groups
"Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
There is NO FATE, we are the creators.
blog: http://damoc.ro/
--
You received this message because you are subscribed to a topic in the
Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elm-discuss/N9OQVt2YHh0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Peter Damoc
2017-08-15 20:30:55 UTC
Permalink
Post by Anthony Naddeo
Assuming I get that to work, what does embed actually do? Is each instance
totally isolated? Does the elm runtime bootstrap itself each time? To share
state, we'll have to use ports?
To my understanding, each instance is isolated.
I don't think there is a way to actually share state but you can keep the
state in various embeds synchronized by using ports.
--
There is NO FATE, we are the creators.
blog: http://damoc.ro/
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...