Comments (12)
Maybe we can just spread the props so we can account for any prop that the original wavesurfer.js adds
from wavesurfer-react.
@teophilus, first of all, thanks for the contribution and your wish to help. I saw your changes and I think that props spreading is very risky, because we would have to guarantee that no unwanted props would go into waveForm options with ...props
.
For example, we implemented some feature A, that would need some prop A, but we accidentally forgot to ignore it inside render method, thus it would go into waveForm options with ...props
.
I would prefer not to use ...props
until it is really necessary.
from wavesurfer-react.
From my point of view, rounded-bars should be described as an additionally available prop. However, there're lots of options that waveform accepts, you can describe them all if you wish. It would be very descriptive for others.
Obviously I have an idea of adding either Flow or TypeScript.
from wavesurfer-react.
Hey! Thanks for getting back to me.
I agree ...props
isn't always the best solution so I'll make a new PR taking your considerations in mind give me a couple of hours.
from wavesurfer-react.
Quick question would you be open to to using prop-types
?
https://reactjs.org/docs/typechecking-with-proptypes.html
from wavesurfer-react.
Quick question would you be open to to using
prop-types
?
https://reactjs.org/docs/typechecking-with-proptypes.html
It's ok. If someday I would move to TS, I will handle it.
from wavesurfer-react.
As soon as your first attempt failed, can you write down all the waveform options we can pass?
from wavesurfer-react.
@teophilus, I think we should just describe options without setting default values to all of them because for the clear start, the only id is required.
from wavesurfer-react.
@teophilus, I think we should just describe options without setting default values to all of them because for the clear start, the only id is required.
I think you might be right! I was getting too many error with my attempt at defaults and type safety.
P.S. Here is the list of options for safe keeping:
audioRate,
audioContext,
audioScriptProcessor,
autoCenter,
backend,
backgroundColor,
barGap,
barHeight,
barRadius,
barWidth,
closeAudioContext,
container,
cursorColor,
cursorWidth,
fillParent,
forceDecode,
height,
hideScrollbar,
interact,
loopSelection,
maxCanvasWidth,
mediaControls,
mediaType,
minPxPerSec,
normalize,
partialRender,
pixelRatio,
plugins,
progressColor,
removeMediaElementOnDestroy,
renderer,
responsive,
scrollParent,
skipLength,
splitChannels,
waveColor,
xhr,
from wavesurfer-react.
@teophilus, package has been updated to 1.1.0 with that feature aboard. You can now pass additional options the following way:
<WaveForm
progressColor="red"
barWidth={3}
barRadius={3}
barGap={3}
cursorWidth={1}
height={200}
>
{regions.map(regionProps => (
<Region
onUpdateEnd={console.log}
key={regionProps.id}
{...regionProps}
/>
))}
/WaveForm>
About typings, most possibly I will use TypeScript as soon as my IDE works great with it.
from wavesurfer-react.
@teophilus, package has been updated to 1.1.0 with that feature aboard. You can now pass additional options the following way:
<WaveForm progressColor="red" barWidth={3} barRadius={3} barGap={3} cursorWidth={1} height={200} > {regions.map(regionProps => ( <Region onUpdateEnd={console.log} key={regionProps.id} {...regionProps} /> ))} /WaveForm>
About typings, most possibly I will use TypeScript as soon as my IDE works great with it.
Awesome! I really appreciate it!
from wavesurfer-react.
@ShiiRochi any updates on getting TypeScript types?
from wavesurfer-react.
Related Issues (20)
- research: find a way to reduce package size
- License: would you be prepared to add a license? HOT 1
- markers: fully updatable solution HOT 1
- Hello, HOT 4
- Typescript errors HOT 2
- WaveSurfer useEffect's run twice in StrictMode HOT 1
- Seeking percentage remains to 0 when behaving as a controlled component
- prop-type dependency HOT 3
- How to setup on wavesurfer create parameters ? HOT 2
- ReferenceError: self is not defined HOT 4
- I can't fire events HOT 7
- useWavesurferHook
- Add functionality of updatable waveform params HOT 2
- Example of in use HOT 5
- Waveform customisation HOT 2
- Can not get zoom to work HOT 5
- Cannot use import statement outside a module HOT 7
- recreate timeline if its id is changed HOT 1
- "Cannot use import statement outside a module" with Next.js HOT 3
- getCurrentTime without triggering too much re-render on the Component HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wavesurfer-react.