Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: [Regions] emit region-update event #3784

Merged
merged 2 commits into from
Jul 14, 2024
Merged

Feat: [Regions] emit region-update event #3784

merged 2 commits into from
Jul 14, 2024

Conversation

katspaugh
Copy link
Owner

Short description

Resolves #3779

Implementation details

A new Regions event is added:

  /** When a region is being updated */
  'region-update': [region: Region, side?: 'start' | 'end']

Example usage

import WaveSurfer from 'wavesurfer.js'
import RegionsPlugin from 'wavesurfer.js/dist/plugins/regions.esm.js'

// Initialize the Regions plugin
const regions = RegionsPlugin.create()

// Create an instance of WaveSurfer
const wavesurfer = WaveSurfer.create({
  container: '#waveform',
  url: '/examples/audio/audio.wav',
  plugins: [regions],
})

regions.on('region-update', (region, side) => {
  console.log('A region is being dragged or resized', region)
})

Copy link

cloudflare-workers-and-pages bot commented Jul 14, 2024

Deploying wavesurfer-js with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9a70543
Status: ✅  Deploy successful!
Preview URL: https://3d96ec0c.wavesurfer-js.pages.dev
Branch Preview URL: https://region-update.wavesurfer-js.pages.dev

View logs

@katspaugh katspaugh merged commit b7c377d into main Jul 14, 2024
4 checks passed
@katspaugh katspaugh deleted the region-update branch July 14, 2024 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: RegionsPluginEvents -> region-update
1 participant