code: function saveRegions() {
      localStorage.regions = JSON.stringify(
          Object.keys(wavesurfer.regions.list).map(function(id) {
              var region = wavesurfer.regions.list[id];
              return {
                  start: region.start,
                  end: region.end,
                  attributes: region.attributes,
                  data: region.data
              };
          })
      );
  }
docs: Save annotations to localStorage.