node-modules / ready-callback Goto Github PK
View Code? Open in Web Editor NEWLaunch server after all async task ready
Launch server after all async task ready
ready-callback 被广泛应用于控制 app 和 agent 启动。
有时候我们会添加一些弱依赖
const done = app.readyCallback('init xx', { isWeakDep: true, timeout: 3000 });
xx.ready(done);
我们写这段代码的时候,设想的是弱依赖的启动控制项不会影响初始化。
但实际上,如果 xx 启动不成功,在出错或者超时的时候必须 done(err),app 才会继续启动。
isWeakDep 目前的语义是或略 done 传过来的 err,继续去 ready,但是前提是 done 还是被调用一次。
这个地方很多 plugin 都踩坑了,也就是说我们以为的弱依赖都变成了强依赖(因为没有保证一定 done)。
@popomore 是否要改进一下 ready-callback,变成 timeout 之后就继续 ready 并不再等 done 被调用.
Remove -g
flag in the npm install
command of the Installation
section.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.