1、Promise是接口
鸿蒙sdk提供的ProPromise版本有点多,是泛型接口,用interface修饰,官网给出的解释是“Represents the completion of an asynchronous operation”,翻译大概意思是:异步操作的完成的处理,总共两回调方法then和catch,api如下:
2、Promise有构造函数PromiseConstructor
鸿蒙提供的sdk源码结构如有:interface修饰的PromiseConstructor
readonly修饰的属性prototype,类型是是:Promise<any>
new 方法,创建一个新的Promise,两个回调函数作为参数,代码结构如下: