Add an uninstall hook to clean up variables.
Pass sanitised widget settings through Drupal.behaviors and process them via external JS on page load.