MFlow  Create and maintain dynamic Web applications as easy and fast as console applications
Thou shall not write request handlers
 This release: 11/06/2014.  agocorona@gmail.com (@agocorona) <>< . issues & bugs .  Mflow Source code,     source code of this site




Configuration of MFlow apps

Suppose that you created a widget that lazy load something, and you need to put a temporal spinner while the stuff loads.

You would write

spinner= img ! src (fromString spinnerurl)
 where
 spinnerurl=  "//ganglia.wikimedia.org/latest/img/spinner.gif"

 But also you want to let the users to change the spinner at exploitation time. Then, use getConfig

Change the last line to:
 spinnerurl=  getConfig "spinner" "//ganglia.wikimedia.org/latest/img/spinner.gif"

When getConfig executes, the key-value pair is added to the mflow.config file in the .tcachedata folder. This configuration file It is a list of key-value pairs. When the user edit the file, change the value and restart the application, the new value will be used instead of the default value that you defined at complilation time.

As easy as that. 

When restarting, the application will show the list of key-value paris used by the application. The unused values (unevaluated) are not written in the configuration. 

If you run dynamic widgets you will notice that in the configuration appear jquery related URLs and so on.  You can edit these entries to make these jquery scripts be downloaded from a local directory or whatever.

The code of the example is extracted from the lazy loading example


comments powered by Disqus