add window.downloadJSON() function for exporting JSON for use in tideline example

@nicolashery LMK what you think, if you'd prefer to reorganize, attach function to `app` instead, etc.