MCPcopy Create free account
hub / github.com/course-dasheng/fe-algorithm / start

Function start

interview/limit-promise.js:30–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28
29
30async function start(){
31 asyncPool({
32 limit: 2,
33 items: [
34 ()=> sleep(1,'吃饭'),
35 ()=> sleep(3,'睡觉'),
36 ()=> sleep(5,'打游戏'),
37 ()=> sleep(3.5,'学习算法'),
38 ()=> sleep(4,'学习Vue和React'),
39 ],
40 async fn(item){
41 return await item()
42 }
43 })
44
45}
46// @think 如果任务有优先级呢
47start()
48

Callers 1

limit-promise.jsFile · 0.70

Calls 2

asyncPoolFunction · 0.85
sleepFunction · 0.70

Tested by

no test coverage detected