未验证 提交 db951cdf 编写于 作者: O openharmony_ci 提交者: Gitee

!9246 Modify the interface information about types in util module

Merge pull request !9246 from 毕虎/master
......@@ -123,17 +123,6 @@ Processes an asynchronous function and returns a promise version.
| -------- | -------- |
| Function | Function in the error-first style (that is, **(err, value) =>...** is called as the last parameter) and the promise version.|
**Example**
```js
function aysnFun() {
return 0;
}
let newPromiseObj = util.promiseWrapper(aysnFun);
newPromiseObj().then(res => {
console.log(res);
})
```
## util.promisify<sup>9+</sup>
promisify(original: (err: Object, value: Object) =&gt; void): Function
......
......@@ -120,17 +120,6 @@ promiseWrapper(original: (err: Object, value: Object) =&gt; void): Object
| -------- | -------- |
| Function | 采用遵循常见的错误优先的回调风格的函数(也就是将&nbsp;(err,&nbsp;value)&nbsp;=&gt;&nbsp;...&nbsp;回调作为最后一个参数),并返回一个返回&nbsp;promise&nbsp;的版本。 |
**示例:**
```js
function aysnFun() {
return 0;
}
let newPromiseObj = util.promiseWrapper(aysnFun);
newPromiseObj().then(res => {
console.log(res);
})
```
## util.promisify<sup>9+</sup>
promisify(original: (err: Object, value: Object) =&gt; void): Function
......@@ -211,7 +200,7 @@ randomBinaryUUID(entropyCache?: boolean): Uint8Array
**示例:**
```js
let uuid = util.randomBinaryUUID(true);
console.log(uuid);
console.log(JSON.stringify(uuid));
// 输出:
// 138,188,43,243,62,254,70,119,130,20,235,222,199,164,140,150
```
......@@ -237,7 +226,7 @@ parseUUID(uuid: string): Uint8Array
**示例:**
```js
let uuid = util.parseUUID("84bdf796-66cc-4655-9b89-d6218d100f9c");
console.log(uuid);
console.log(JSON.stringify(uuid));
// 输出:
// 132,189,247,150,102,204,70,85,155,137,214,33,141,16,15,156
```
......@@ -2764,5 +2753,5 @@ isSharedArrayBuffer(value: Object): boolean
**示例:**
```js
var that = new util.types();
var result = that.isSharedArrayBuffer(new SharedArrayBuffer([]));
var result = that.isSharedArrayBuffer(new SharedArrayBuffer(0));
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册