diff --git a/en/application-dev/reference/apis/js-apis-util.md b/en/application-dev/reference/apis/js-apis-util.md index abf2b4a31a27cefcf9cf1e653a8e2e4249b5a6fb..e0fcbc5689c1b0f90f4aec8713d4cd2c4a679daf 100755 --- a/en/application-dev/reference/apis/js-apis-util.md +++ b/en/application-dev/reference/apis/js-apis-util.md @@ -105,7 +105,7 @@ Calls back an asynchronous function. In the callback, the first parameter indica promiseWrapper(original: (err: Object, value: Object) => void): Object > **Introduce**
-> Starting from API version 9, it is recommended to use [util.promisewrapper9 +] (\utilpromisewrapper9) instead. +> Deprecated starting from API version 9, it is recommended to use [util.promisify9 +] (\utilpromisify9) instead. Processes an asynchronous function and returns a promise version. @@ -132,9 +132,9 @@ Processes an asynchronous function and returns a promise version. }) ``` -## util.promiseWrapper9+ +## util.promisify9+ -promiseWrapper(original: (err: Object, value: Object) => void): Function +promisify(original: (err: Object, value: Object) => void): Function Processes an asynchronous function and returns a promise function. @@ -159,7 +159,7 @@ Processes an asynchronous function and returns a promise function. return str1 } } - let newPromiseObj = util.promiseWrapper(aysnFun); + let newPromiseObj = util.promisify(aysnFun); newPromiseObj({ err: "type error" }, {value:'HelloWorld'}).then(res => { console.log(res); }) diff --git a/zh-cn/application-dev/reference/apis/js-apis-util.md b/zh-cn/application-dev/reference/apis/js-apis-util.md index fd4425ef4524d75c71a64e657e575cecc2f33dd0..742e63da1256359ad60510c0283ae75ac9577d52 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-util.md +++ b/zh-cn/application-dev/reference/apis/js-apis-util.md @@ -104,7 +104,7 @@ callbackWrapper(original: Function): (err: Object, value: Object )=>void promiseWrapper(original: (err: Object, value: Object) => void): Object > **说明:**
-> 从API Version 9开始废弃,建议使用[util.promiseWrapper9+](#utilpromisewrapper9)替代。 +> 从API Version 9开始废弃,建议使用[util.promisify9+](#utilpromisify9)替代。 对异步函数处理并返回一个promise的版本。 @@ -131,9 +131,9 @@ promiseWrapper(original: (err: Object, value: Object) => void): Object }) ``` -## util.promiseWrapper9+ +## util.promisify9+ -promiseWrapper(original: (err: Object, value: Object) => void): Function +promisify(original: (err: Object, value: Object) => void): Function 对异步函数处理并返回一个promise的函数。 @@ -158,7 +158,7 @@ promiseWrapper(original: (err: Object, value: Object) => void): Function return str1 } } - let newPromiseObj = util.promiseWrapper(aysnFun); + let newPromiseObj = util.promisify(aysnFun); newPromiseObj({ err: "type error" }, {value:'HelloWorld'}).then(res => { console.log(res); })