In Node.js , if I do this:
var doNoResolve = true;
function a() {
return new Promise(resolve => {
if (doNotResolve) {
return
}
resolve(10);
});
}
a().then(() => {
});
Is there a memory leak on an incoming request? If I used the plain old callback, everything would have worked just fine if I hadn't performed any callback, but it looks like it might not be ... the name promise itself implies that this is somewhat wrong.
If I had to return a “fake promise” ( return { then: () => {} }) inside function a(), and not a “real promise”, if doNotResolve was true, but that’s a little rude.
- React.js, HTTP , ( , , , , ).