zrho / purescript-optic-ui

PureScript UI framework based on lenses.
122 stars 10 forks source link

Return "driver" function from animate #13

Closed FrigoEU closed 8 years ago

FrigoEU commented 8 years ago

Hey,

Similar to Halogen's driver function, I added a function that gets returned when calling animate. To this function you can pass another function (s -> s) so you can change the state from the outside. I needed this to change some state when the browser's hash changes, but it can be used in some other ways also: timers, websockets, etc.

Simon

zrho commented 8 years ago

That sounds useful! I'll have a look on all the proposed changes on Thursday once I've finished work for this week. I'm really glad to how much you all want to see this move forward! Am 18.11.2015 00:26 schrieb "Simon Van Casteren" notifications@github.com:

Hey,

Similar to Halogen's driver function, I added a function that gets returned when calling animate. To this function you can pass another function (s -> s) so you can change the state from the outside. I needed this to change some state when the browser's hash changes, but it can be used in some other ways also: timers, websockets, etc.

Simon

You can view, comment on, or merge this pull request online at:

https://github.com/zrho/purescript-optic-ui/pull/13 Commit Summary

  • Added driver
  • Improved driver function

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/zrho/purescript-optic-ui/pull/13.

zrho commented 8 years ago

This circumvents the generation check, but that should be fine, I think, since the driver is only generated once in the beginning and does not include any reference to the state.