funcool

A channel for discussing and asking questions about Funcool libraries https://github.com/funcool/
martinklepsch 2016-07-11T08:41:20.000022Z

@niwinz: hey! I started reading the UXbox code, cool stuff 👍, were there any particular things that served as inspiration for the event abstractions?

niwinz 2016-07-11T08:45:37.000024Z

hmm no, some ideas from elm

niwinz 2016-07-11T08:45:49.000025Z

thanks!

niwinz 2016-07-11T08:46:13.000026Z

many ideas are own,

martinklepsch 2016-07-11T09:03:34.000027Z

the WatchEvent is a clever idea and it's also nice that events can be Update+Watch in one because they're just protocols

niwinz 2016-07-11T09:19:17.000028Z

yes, and the order always is

niwinz 2016-07-11T09:19:27.000029Z

Update > Watch > Effect

niwinz 2016-07-11T09:19:44.000030Z

so watch will receive the state already updated by the update

niwinz 2016-07-11T09:20:15.000031Z

and watch receives the main stream so it can react to posterior events for cancel/abort stuff

niwinz 2016-07-11T09:21:10.000032Z

tipical case for autocomplete backed by backend that allows cancel xhr requests if the user writes quickly

martinklepsch 2016-07-11T09:31:15.000033Z

> and watch receives the main stream so it can react to posterior events for cancel/abort stuff I'm not sure I understand. Are WatchEvents cancelable? how? (maybe there's an example in the code?)

niwinz 2016-07-11T10:27:53.000036Z

maybe it can serve as example

niwinz 2016-07-11T10:28:29.000037Z

the basic is, in watch event you trigger some async stuff and in same time subscribe to main stream for watch if more events of same type are emited by the ui

niwinz 2016-07-11T10:28:52.000038Z

so you can react old requests and leave only the most recent continue

niwinz 2016-07-11T10:29:00.000039Z

in an hipotetical use case

martinklepsch 2016-07-11T11:20:58.000040Z

ah ok, I see, saw the stoper thing before but didn't fully understand it's utility.

martinklepsch 2016-07-11T11:22:16.000041Z

any reason you don't use positional record constructors?

niwinz 2016-07-11T11:46:16.000042Z

I don't like its syntax

niwinz 2016-07-11T11:47:07.000043Z

is just esthetic preference

niwinz 2016-07-11T11:48:53.000044Z

about the other topic, maybe is not clear the purpose on simple view but is very very useful

niwinz 2016-07-11T11:49:25.000045Z

for implement things like autocomplete backed by server returned results

niwinz 2016-07-11T11:50:01.000046Z

you should be able cancel old requests in order to proceed with news ones on the user input...

niwinz 2016-07-11T11:50:09.000047Z

and this allows do that