Giter VIP home page Giter VIP logo

Comments (12)

teophilus avatar teophilus commented on June 4, 2024

Maybe we can just spread the props so we can account for any prop that the original wavesurfer.js adds

from wavesurfer-react.

ShiiRochi avatar ShiiRochi commented on June 4, 2024

@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.

ShiiRochi avatar ShiiRochi commented on June 4, 2024

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.

teophilus avatar teophilus commented on June 4, 2024

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.

teophilus avatar teophilus commented on June 4, 2024

Quick question would you be open to to using prop-types?
https://reactjs.org/docs/typechecking-with-proptypes.html

from wavesurfer-react.

ShiiRochi avatar ShiiRochi commented on June 4, 2024

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.

ShiiRochi avatar ShiiRochi commented on June 4, 2024

As soon as your first attempt failed, can you write down all the waveform options we can pass?

from wavesurfer-react.

ShiiRochi avatar ShiiRochi commented on June 4, 2024

@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 avatar teophilus commented on June 4, 2024

@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.

ShiiRochi avatar ShiiRochi commented on June 4, 2024

@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 avatar teophilus commented on June 4, 2024

@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.

tslater avatar tslater commented on June 4, 2024

@ShiiRochi any updates on getting TypeScript types?

from wavesurfer-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.