I've worked with both Polymer and Elm, so I can maybe help you with some things. I haven't really put them together apart from one silly proof of concept <https://github.com/ohanhi/polymer-in-elm>, though. I should probably try and resurrect that repo.
Anyways, to get the new date: paper-date-picker has the date property set to notify: true, which means it should emit an event called date-changed as per the Polymer specs <https://www.polymer-project.org/1.0/docs/devguide/properties#notify>. In this specific case, you want to be listening with on "date-changed" in Elm. Generally speaking, the event is the "kebab-case", or "dash-case" version of the property name, plus "-changed", so if the property was e.g. weekNumber, the corresponding event would be week-number-changed. Note, however, that it might be tricky to do it this way, since the component likely stores an actual JS Date object as the value. Maybe the easiest way to check the behavior is by listening for the event in plain JS and logging it in the console. On Friday, September 23, 2016 at 3:28:06 PM UTC+3, Peter Damoc wrote: > > I've been trying to get this to work but I don't have enough knowledge. > > The main problem I'm facing seams to be one of setup/deployment. > > Can someone help with a simple example that uses paper-date-picker > https://customelements.io/bendavis78/paper-date-picker/ > > I'm looking for the following: > > - a file structure/setup for the project that allows development of an Elm > program using paper-date-picker where one can see the same output in both > Chrome and Firefox > - a way capture a notification for the date change > > less important but useful: > - a way to create some kind of a deliverable (something that one can put > on some webhosting and have it work) > > Regarding the event from the component I've found > https://github.com/kevinlebrun/elm-polymer > but I was unable to transfer the knowledge shown there for how to listen > to changes inside the web component. > > Setting the date value with attribute (counter-polymer-inside-elm) > actually proved to be very easy and it worked without needing the port. > Getting informed about the date change happening inside the widget > however, did not work. > > I tried replacing "value" with "date" in the event attribute and the json > decoder (replacing Json.int with Json.string) but... it did not work. > > Here are the files I have so far: > https://gist.github.com/pdamoc/48c6f7dd2f7fec44bdd3262f269f635c > > > > > -- > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
