Mapping the demo


By the time that A gigantic pub crawl gets here, then various components will have suggested pubs inside an area and declared pub crawls. We can use the Maps API to work out the optimal route between places and plot them on  map. Github repo is here.


Here's an example.



We can change to another pub crawl with the drop down, and so on.


How does this work ?

The mapper is kicked off from a link in the parameter spreadsheet that's been automatically primed with an item id and access key. This tells the app where to go in cache to find what it's supposed to do. 

Once started, it listens for changes in cache and adds any newly declared routes to the dropdown. No manual  intervention or refreshing is required.

Listening for changes

Just as in Controlling the demo the efx JavaScript api client is used, like this. If it detects any changes in cache, it will calculate the best routes and add it to the drop down. I won't go into the details of that here, but if you are interested you can find the whole app on github.
        efx.on("update", keys.item, keys.updater, function (id, packet) {

            efx.read (keys.item)
            .then (function (result) {
              if (!result.data.ok) {
                errify ("couldnt get item after push", JSON.stringify(result.data));
              }
              else {
                maps.orchestrate (result.data.value);
              }
            });
          }, {
          type: "push"
        });

It can handle multiple areas just by looking at a difference cache item. Here's one from new york that's been cooking in the background too.


You can read the api documentation for efx here 





For more like this, see Ephemeral Exchange Why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available.
Comments