[elm-discuss] Re: JS interop and the DOM

2016-10-04 Thread Brian Cardiff
Hi Vojtech,

You will need to use ports ( 
https://guide.elm-lang.org/interop/javascript.html ). A Cmd is sent to JS 
land after the view function is called.

A minimal sample of that can be found 
in https://gist.github.com/bcardiff/abde5f7c08da50136de05a3e879ebc08 

A (string) selector over a cmd is sent and in JS select the node to perform 
the desired operation.

Regards,

On Tuesday, October 4, 2016 at 3:23:05 AM UTC-3, Vojtěch Král wrote:
>
> Hi!
>   This might be a newbie question but I wasn't able to find anything by 
> googling around.
> I'd like to use a 3rd party JS library (Cystoscape) that needs to 
> initialize on a DOM HTML element where it renders stuff.
> However the since the DOM is generated by Elm, I don't know at which point 
> to initialize the library.
> I'd need some kind of a "DOM ready" event from Elm.
> Is there such a thing?
>
> Thanks,
> Vojtech
>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Sending a message from spawned process

2016-09-20 Thread Brian Cardiff
On Wednesday, September 21, 2016 at 2:09:30 AM UTC-3, Brian Cardiff wrote:
>
> Hi,
>
> In elm 0.17.1, is it possible to send a message to the app from a spawned 
> process? If so, How? :-) 
>
> Some days ago I failed to do that. I wanted to implement a debounce 
> module. The rough idea was that from a message I want to debounce a spawned 
> process would start. First it will do a sleep and then it should message 
> the app.
>
> Spawning the process is required so in the next message of the user, the 
> previous "setTimeout" process can be killed. The Process.Id is needed.
>
> I was forced to take a different approach. Basically, filtering the 
> outdated "setTimeouts". But I would really like to change that.
>
> In case you want to see more source, the package is: 
> http://package.elm-lang.org/packages/bcardiff/elm-debounce/latest/Debounce . 
> And the spawn branch is as far as I got: spawning the process, getting the 
> Id, but unable to receive a message after the sleep.
>
> Thanks in advance,
>

For sure any feedback is welcome. If other approach should/could have been 
taken to debounce events I am all ears, well ... eyes.
 

> -- 
> Brian J. Cardiff - Manas Technology Solutions
> [ar.phone] 4796.0232 #BCR(227)
> [us.phone] 312.612.1050  #BCR(227)
> [email] bcard...@manas.com.ar
> [web] www.manas.com.ar
> [weblog] http://weblogs.manas.com.ar/bcardiff/
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.