diff --git a/zh-cn/application-dev/reference/apis/js-apis-contact.md b/zh-cn/application-dev/reference/apis/js-apis-contact.md index 0bf871d0b4d18fe2c8a4806994830df07b50e528..f3e4ebbba4467ac2b936bb81bba8956915ba4f64 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-contact.md +++ b/zh-cn/application-dev/reference/apis/js-apis-contact.md @@ -776,7 +776,7 @@ queryContacts(attrs: ContactAttributes, callback: AsyncCallback<Array<Cont ## contact.queryContacts -queryContacts(holder: Holder, attrs: ContactAttributes, callback: AsyncCallback<Array<Contact>>) +queryContacts(holder: Holder, attrs: ContactAttributes, callback: AsyncCallback<Array<Contact>>): void 查询所有联系人,使用callback方式作为异步方法。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-http.md b/zh-cn/application-dev/reference/apis/js-apis-http.md index 9445c2666ae901bf972a1248485092ad056a7361..9627277e43ed66a1fab9e54ac41a639b842e1a38 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-http.md +++ b/zh-cn/application-dev/reference/apis/js-apis-http.md @@ -137,25 +137,25 @@ request\(url: string, options: HttpRequestOptions, callback: AsyncCallback { - if (!err) { - console.info('Result:' + data.result); - console.info('code:' + data.responseCode); - console.info('header:' + data.header); - console.info('cookies:' + data.cookies); // 8+ - console.info('header['Content-Type']:' + data.header['Content-Type']); - console.info('header['Status-Line']:' + data.header['Status-Line']); - console.info('header.Date:' + data.header.Date); - console.info('header.Server:' + data.header.Server); - } else { - console.info('error:' + err.data); - } + method: 'GET', + header: { + 'Content-Type': 'application/json' + }, + readTimeout: 60000, + connectTimeout: 60000 +}, (err, data) => { + if (!err) { + console.info('Result:' + data.result); + console.info('code:' + data.responseCode); + console.info('header:' + data.header); + console.info('cookies:' + data.cookies); // 8+ + console.info('header.Content-Type:' + data.header['Content-Type']); + console.info('header.Status-Line:' + data.header['Status-Line']); + console.info('header.Date:' + data.header.Date); + console.info('header.Server:' + data.header.Server); + } else { + console.info('error:' + err.data); + } }); ``` @@ -188,24 +188,24 @@ request\(url: string, options? : HttpRequestOptions\): Promise ``` let promise = httpRequest.request("EXAMPLE_URL", { - method: "GET", - connectTimeout: 60000, - readTimeout: 60000, - header: { - 'Content-Type': 'application/json' - } + method: "GET", + connectTimeout: 60000, + readTimeout: 60000, + header: { + 'Content-Type': 'application/json' + } }); promise.then((value) => { - console.info('Result:' + value.result); - console.info('code:' + value.responseCode); - console.info('header:' + value.header); - console.info('cookies:' + value.cookies); // 8+ - console.info('header['Content-Type']:' + value.header['Content-Type']); - console.info('header['Status-Line']:' + value.header['Status-Line']); - console.info('header.Date:' + value.header.Date); - console.info('header.Server:' + value.header.Server); + console.info('Result:' + value.result); + console.info('code:' + value.responseCode); + console.info('header:' + value.header); + console.info('cookies:' + value.cookies); // 8+ + console.info('header.Content-Type:' + value.header['Content-Type']); + console.info('header.Status-Line:' + value.header['Status-Line']); + console.info('header.Date:' + value.header.Date); + console.info('header.Server:' + value.header.Server); }).catch((err) => { - console.error(`errCode:${err.code}, errMessage:${err.data}`); + console.error(`errCode:${err.code}, errMessage:${err.data}`); }); ``` @@ -246,9 +246,9 @@ on\(type: 'headerReceive', callback: AsyncCallback\): void ``` httpRequest.on('headerReceive', (err, data) => { if (!err) { - console.info('header: ' + data.header); + console.info('header: ' + data.header); } else { - console.info('error:' + err.data); + console.info('error:' + err.data); } }); ``` @@ -280,9 +280,9 @@ off\(type: 'headerReceive', callback?: AsyncCallback\): void ``` httpRequest.on('headerReceive', (err, data) => { if (!err) { - console.info('header: ' + data.header); + console.info('header: ' + data.header); } else { - console.info('error:' + err.data); + console.info('error:' + err.data); } }); httpRequest.off('headerReceive'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-sim.md b/zh-cn/application-dev/reference/apis/js-apis-sim.md index 89fb4e51662c962a300e6c76e5ebe74da1897ed6..04ae6c9c446509fd4546c78ceaf1850e18efe61c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sim.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sim.md @@ -140,7 +140,7 @@ sim.hasOperatorPrivileges(0, (err, data) => { ## sim.hasOperatorPrivileges7+ -hasOperatorPrivileges(slotId: number): Promise +hasOperatorPrivileges(slotId: number): Promise 检查应用(调用者)是否已被授予运营商权限,使用Promise方式作为异步方法。