The usage of Promise

  node.js, question

When using Promise of ES6, an asynchronous function is generally wrapped with Promise in one layer:

var test = function(data){
 
 return new Promise(function(resolve,reject){
 
 try{
 
 if(data.statue === "SUCCESS"){
 
 resolve(data);
 
 }else{
 
 reject(data);
 
 bracket
 
 }catch(e){
 
 reject(e)
 
 bracket
 
 })
 
 bracket

However, I learned that the promise object can be used directly and can not be used to wrap any asynchronous (or synchronous) process:

var promise = new Promise(function(resolve,reject){
 
 //   ...
 resolve(999);
 
 })
 
 promise.then(function(value){
 console.log(value);  // 999
 }).catch(function(error){
 console.error(error);
 })

May I ask under what circumstances is this direct use mainly used?

What do you mean by direct use?

var promise = new Promise(function(resolve,reject){
 //null implementation
 })

Is it empty? Then I will tell you that there is no such usage scenario, because this usage will never be usedresolveOr ..reject. So it doesn’t make sense

According to the problem correction:

I don’t usually write it your way, too long-winded. The abbreviation is like this

Promise
 .resolve(999)
 //Chain Possibility

This usage is because there may be a series of operations that can be (or need to be) called in a chain, and they also need onePromiseAs a starting point