Narcissistic Passion Minified

    progress-it
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.1 • Public • Published


    Logo

    🤞🏻 Map Boolean As Floating Number, Simple And Functional
    Preview | Example

    start

    yarn add progress-it 
    or
    npm install progress-it
    import progress from "progress-it"
    const effect=console.log
    const stateSetter = progress(effect)(false);
    const finish=()=>stateSetter(true)
    const fail=()=>stateSetter('fail')
    setTimeout(finish,1000)

    output

    0.0000001 false
    0.0000002 false
    0.0000004 false
    ...
    0.9999999 false
    # after 1000ms 
    1 true

    api

    type Effect = (percent: number, state: boolean | 'fail') => void;
    interface IProgressPotions {
        interval: number;//default 100
        speed: number; //default 0.01
    }
    type Setter=(newState: boolean | 'fail')=>Setter
    const progress: (effect: Effect, option: Partial<IProgressPotions>) => (initState: boolean) => (newState: boolean) => Setter;
    const stateSetter:Setter = progress(effect)(false);

    Keywords

    none

    Install

    npm i progress-it

    DownloadsWeekly Downloads

    18

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    17.2 kB

    Total Files

    15

    Last publish

    Collaborators

    • zalss