Clear Dashing Widgets

There are a handful of ways of clearing old widget data from Dashing, but none are well documented. Here are a few options, all of which boil down to the line:

Sinatra::Application.settings.history.clear()

This can go in a few places, depending on when and how you want the history cleared. We are dynamically making and discarding tons of widgets, so regularly clearing out the stale data is useful for us.

The main options are:

Clear widgets when Dashing starts:

Find the config.ru file, and add the line before the "run Sinatra::Application" line.

Clear widgets on a schedule:

Make a new job file in the jobs/ folder and create a file that looks something like:

The above will clear the history every midnight. The '0 0 * * *' is the schedule, using the format for cron jobs.