Skip to content

promise封装setInterval #2

@orozot

Description

@orozot
const wrapAsyncFn = function() {
    return new Promise((resovle,reject)=>{
        let result = 0;
        setInterval(()=>{
           result++;
           resovle(result)
        },1000);
    })
}

wrapAsyncFn().then(res => {
    // 我全都要
    console.log(res)
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions