Skip to content

Commit

Permalink
Fix: [Regions] export Region class for TypeScript docs (#3775)
Browse files Browse the repository at this point in the history
* Fix: [Regions] export Region class for TypeScript docs

* prettier
  • Loading branch information
katspaugh committed Jul 3, 2024
1 parent 001f3d0 commit ed589cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<img width="626" alt="waveform screenshot" src="https://github.com/katspaugh/wavesurfer.js/assets/381895/05f03bed-800e-4fa1-b09a-82a39a1c62ce">

**Golden sponsor 💖** [Closed Caption Creator](https://www.closedcaptioncreator.com)
**Gold sponsor 💖** [Closed Caption Creator](https://www.closedcaptioncreator.com)

## Getting started

Expand Down
8 changes: 3 additions & 5 deletions src/plugins/regions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export type RegionParams = {
contentEditable?: boolean
}

class SingleRegion extends EventEmitter<RegionEvents> {
class Region extends EventEmitter<RegionEvents> {
public element: HTMLElement
public id: string
public start: number
Expand Down Expand Up @@ -586,7 +586,7 @@ class RegionsPlugin extends BasePlugin<RegionsPluginEvents, RegionsPluginOptions

const duration = this.wavesurfer.getDuration()
const numberOfChannels = this.wavesurfer?.getDecodedData()?.numberOfChannels
const region = new SingleRegion(options, duration, numberOfChannels)
const region = new Region(options, duration, numberOfChannels)

if (!duration) {
this.subscriptions.push(
Expand Down Expand Up @@ -639,7 +639,7 @@ class RegionsPlugin extends BasePlugin<RegionsPluginEvents, RegionsPluginOptions
const end = ((x + initialSize) / width) * duration

// Create a region but don't save it until the drag ends
region = new SingleRegion(
region = new Region(
{
...options,
start,
Expand Down Expand Up @@ -678,5 +678,3 @@ class RegionsPlugin extends BasePlugin<RegionsPluginEvents, RegionsPluginOptions
}

export default RegionsPlugin

export type Region = InstanceType<typeof SingleRegion>

0 comments on commit ed589cf

Please sign in to comment.