re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
Rabie 2020-07-25T02:06:39.063800Z

Hello, Is there a way to dispatch reframe events from Javascript functions in the webpage? I would like to migrate to reframe an app I made that uses google maps. When you click on a markup in gmaps a javascript event function handler is called. I would like to know if there is a way to dispatch a reframe event from theses javascript functions. Thank you

Rabie 2020-07-25T02:09:02.063900Z

Maybe this guide coud help you figure out https://purelyfunctional.tv/guide/state-in-re-frame/

2020-07-25T04:48:25.064900Z

You could write the handler in ClojureScript and export it.

1👍
p-himik 2020-07-25T05:38:52.065500Z

Wrap re-frame.core/dispatch in a function marked with ^:export.

1👍
dpsutton 2020-07-25T05:49:48.066400Z

Can you easily construct keywords from js? And vectors? Or will js arrays work?

p-himik 2020-07-25T05:53:07.067Z

That wrapper can do that. And whatever else might be needed to bridge JS and re-frame.

p-himik 2020-07-25T05:55:09.067400Z

JS arrays will not work because there's an explicit check for vector?.

reefersleep 2020-07-25T12:12:25.069700Z

Kaocha is a nice runner once you have many, many tests; the output is much more compact than the default runner. And more nicely colorized, I think.

reefersleep 2020-07-25T12:17:13.071500Z

@jacob429 just to add; if you're concerned about timing, dispatch-sync is another tool in re-frame you could consider 😊

reefersleep 2020-07-25T13:02:58.073200Z

When considering initialising your state in re-frame from the form-2 outer function, that is.

reefersleep 2020-07-25T13:11:00.079900Z

Reasons I would consider initializing beforehand; When the user can interact with a half-initialized app and create unfortunate states (this can be hard to spot) When showing a fully loaded page is more important than shortening pageloading times (or when load is fast enough) When there's a technical reason that something can't be shown with only partial state

Rabie 2020-07-25T14:30:36.081100Z

Thank you for your answer

Rabie 2020-07-25T14:35:53.083800Z

A non related question. Has anyone worked with reframe and https://react-bootstrap.github.io/? I found some examples of integrating https://github.com/burhanloey/reagent-react-bootstrap/tree/master/src/reagent_react_bootstrap. But I was wondering, given that reframe comes with its own react (from my understanding), if it was possible to tell reframe to use react-bootsrap instead of react or if that would lead to some unwanted conflicts? Thank you

p-himik 2020-07-25T14:38:35.083900Z

re-frame doesn't come with its own React. re-frame uses Reagent, which requires React.

p-himik 2020-07-25T14:39:48.084100Z

And react-bootstrap is just a library built on top of React. If you decide to use it, it will just use React that's already used in your project.

Rabie 2020-07-25T14:43:10.084300Z

Ah ok. Thanks for clarifying @p-himik

Jacob Emcken 2020-07-25T14:59:49.084500Z

@rnait1977 it is a really good link. I've read it before bugged you peeps and it is part of the reason why I got inspired to look at local state, but thanks 👍

Jacob Emcken 2020-07-25T15:01:05.084700Z

@reefersleep I didn't think of the dispatch-sync and form-2 combination. I'll keep that in mind, thanks

1🍻
Jacob Emcken 2020-07-25T15:10:24.085Z

I have a dynamic data specification which I assume will changes very rarely, but when it does it will affect the entire application. My gut feeling tells me I should avoid re-calculating how a form that I'm not currently "looking at" (in the browser) should look when (if ever) the form is shown. I might have quite a few of these forms that would all need "re-calculation". But I guess that is a problem for when (if) that actually becomes a problem.