Hi all,
I created a spa in re-frame that dynamically generates a wizard. The layout of the wizard is currently defined in app-db. But I want to use the same compiled code for different wizards. So I want to pass somehow that wizard configuration at runtime to the spa.
With this, I hand the compiled js over to the python flask team. And they will be able to generate all the wizards they want, just by changing the configuration, without a need to recompile the clojurescript code.
Any suggestions, ideas on how to implement this?
Thanks in advance.
An SPA might initialize its app-db from an online web service, from random numbers, or from things it finds in the browser environment - such as the URL and the JS variables. An example of the latter is an HTML page that has a tiny script tag that sets a configuration variable before the script tag that loads the SPA.
If I understand your question correctly:…
An approach would be to store the widget configuration as normal data.
I had the same requirement. So you could make something like:
(def config1
[{:step 1 :type ,,, :content ,,, :other ,,, :data}
{:step 2 :type ,,, :content ,,,, :other ,,,, :date}])
And then basically in Re-frame create a ‘wizard engine’. Ie, handlers for ‘next’ and ‘prev’, subscriptions for what current step is active, etc.
All the configuration can be stored somewhere external and passed in.
you could also leverage multi-methods to render config data based on :type for example.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.