提交 7174988c 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 4535003d
...@@ -45,7 +45,7 @@ Use [Locale](../reference/apis/js-apis-intl.md#locale) APIs to maximize or minim ...@@ -45,7 +45,7 @@ Use [Locale](../reference/apis/js-apis-intl.md#locale) APIs to maximize or minim
```js ```js
var locale = "zh-CN"; var locale = "zh-CN";
var options = {caseFirst: false, calendar: "chinese", collation: "pinyin"}; var options = {caseFirst: "false", calendar: "chinese", collation: "pinyin"};
var localeObj = new intl.Locale(locale, options); var localeObj = new intl.Locale(locale, options);
``` ```
...@@ -347,4 +347,4 @@ The following sample is provided to help you better understand how to develop in ...@@ -347,4 +347,4 @@ The following sample is provided to help you better understand how to develop in
-[`International`: Internationalization (JS) (API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/International) -[`International`: Internationalization (JS) (API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/International)
-[`International`: Internationalization (eTS) (API8) (Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/common/International) -[`International`: Internationalization (ArkTS) (API8) (Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/common/International)
...@@ -5,3 +5,4 @@ ...@@ -5,3 +5,4 @@
- [Raw File Development](rawfile-guidelines.md) - [Raw File Development](rawfile-guidelines.md)
- [Native Window Development](native-window-guidelines.md) - [Native Window Development](native-window-guidelines.md)
- [Using MindSpore Lite for Model Inference](mindspore-lite-guidelines.md) - [Using MindSpore Lite for Model Inference](mindspore-lite-guidelines.md)
- [Connecting the Neural Network Runtime to an AI Inference Framework](neural-network-runtime-guidelines.md)
...@@ -112,6 +112,8 @@ For details about the error codes, see [Screen Hopping Error Codes](../errorcode ...@@ -112,6 +112,8 @@ For details about the error codes, see [Screen Hopping Error Codes](../errorcode
**Example** **Example**
```js ```js
let sinkDeviceDescriptor = "descriptor";
let srcInputDeviceId = 0;
try { try {
inputDeviceCooperate.start(sinkDeviceDescriptor, srcInputDeviceId, (error) => { inputDeviceCooperate.start(sinkDeviceDescriptor, srcInputDeviceId, (error) => {
if (error) { if (error) {
...@@ -160,6 +162,8 @@ For details about the error codes, see [Screen Hopping Error Codes](../errorcode ...@@ -160,6 +162,8 @@ For details about the error codes, see [Screen Hopping Error Codes](../errorcode
**Example** **Example**
```js ```js
let sinkDeviceDescriptor = "descriptor";
let srcInputDeviceId = 0;
try { try {
inputDeviceCooperate.start(sinkDeviceDescriptor, srcInputDeviceId).then(() => { inputDeviceCooperate.start(sinkDeviceDescriptor, srcInputDeviceId).then(() => {
console.log(`Start Keyboard mouse crossing success.`); console.log(`Start Keyboard mouse crossing success.`);
...@@ -249,6 +253,7 @@ Checks whether screen hopping is enabled. This API uses an asynchronous callback ...@@ -249,6 +253,7 @@ Checks whether screen hopping is enabled. This API uses an asynchronous callback
**Example** **Example**
```js ```js
let deviceDescriptor = "descriptor";
try { try {
inputDeviceCooperate.getState(deviceDescriptor, (error, data) => { inputDeviceCooperate.getState(deviceDescriptor, (error, data) => {
if (error) { if (error) {
...@@ -324,7 +329,7 @@ try { ...@@ -324,7 +329,7 @@ try {
inputDeviceCooperate.on('cooperation', (data) => { inputDeviceCooperate.on('cooperation', (data) => {
console.log(`Keyboard mouse crossing event: ${JSON.stringify(data)}`); console.log(`Keyboard mouse crossing event: ${JSON.stringify(data)}`);
}); });
} catch (err) { } catch (error) {
console.log(`Register failed, error: ${JSON.stringify(error, [`code`, `message`])}`); console.log(`Register failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
} }
``` ```
...@@ -350,25 +355,25 @@ Disables listening for screen hopping events. ...@@ -350,25 +355,25 @@ Disables listening for screen hopping events.
```js ```js
// Unregister a single callback. // Unregister a single callback.
callback: function(event) { function callback(event) {
console.log(`Keyboard mouse crossing event: ${JSON.stringify(event)}`); console.log(`Keyboard mouse crossing event: ${JSON.stringify(event)}`);
return false; return false;
} }
try { try {
inputDeviceCooperate.on('cooperation', this.callback); inputDeviceCooperate.on('cooperation', callback);
inputDeviceCooperate.off("cooperation", this.callback); inputDeviceCooperate.off("cooperation", callback);
} catch (error) { } catch (error) {
console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
} }
``` ```
```js ```js
// Unregister all callbacks. // Unregister all callbacks.
callback: function(event) { function callback(event) {
console.log(`Keyboard mouse crossing event: ${JSON.stringify(event)}`); console.log(`Keyboard mouse crossing event: ${JSON.stringify(event)}`);
return false; return false;
} }
try { try {
inputDeviceCooperate.on('cooperation', this.callback); inputDeviceCooperate.on('cooperation', callback);
inputDeviceCooperate.off("cooperation"); inputDeviceCooperate.off("cooperation");
} catch (error) { } catch (error) {
console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
......
...@@ -197,12 +197,12 @@ Disables listening for hot swap events of an input device. ...@@ -197,12 +197,12 @@ Disables listening for hot swap events of an input device.
**Example** **Example**
```js ```js
function callback(data) { callback: function(data) {
console.log("type: " + data.type + ", deviceId: " + data.deviceId); console.log("type: " + data.type + ", deviceId: " + data.deviceId);
} }
try { try {
inputDevice.on("change", callback); inputDevice.on("change", this.callback);
} catch (error) { } catch (error) {
console.info("oninputdevcie " + error.code + " " + error.message) console.info("oninputdevcie " + error.code + " " + error.message)
} }
...@@ -212,7 +212,7 @@ inputDevice.on("change", listener); ...@@ -212,7 +212,7 @@ inputDevice.on("change", listener);
// Disable this listener. // Disable this listener.
try { try {
inputDevice.off("change", callback); inputDevice.off("change", this.callback);
} catch (error) { } catch (error) {
console.info("offinputdevcie " + error.code + " " + error.message) console.info("offinputdevcie " + error.code + " " + error.message)
} }
...@@ -333,7 +333,7 @@ inputDevice.getDevice(1).then((inputDevice)=>{ ...@@ -333,7 +333,7 @@ inputDevice.getDevice(1).then((inputDevice)=>{
## inputDevice.supportKeys<sup>9+</sup> ## inputDevice.supportKeys<sup>9+</sup>
supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: Callback&lt;Array&lt;boolean&gt;&gt;): void supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: AsyncCallback &lt;Array&lt;boolean&gt;&gt;): void
Obtains the key codes supported by the input device. This API uses an asynchronous callback to return the result. Obtains the key codes supported by the input device. This API uses an asynchronous callback to return the result.
...@@ -345,7 +345,7 @@ Obtains the key codes supported by the input device. This API uses an asynchrono ...@@ -345,7 +345,7 @@ Obtains the key codes supported by the input device. This API uses an asynchrono
| -------- | ------------------------------------ | ---- | --------------------------------- | | -------- | ------------------------------------ | ---- | --------------------------------- |
| deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.| | deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.|
| keys | Array&lt;KeyCode&gt; | Yes | Key codes to be queried. A maximum of five key codes can be specified. | | keys | Array&lt;KeyCode&gt; | Yes | Key codes to be queried. A maximum of five key codes can be specified. |
| callback | Callback&lt;Array&lt;boolean&gt;&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;Array&lt;boolean&gt;&gt; | Yes | Callback used to return the result. |
**Example** **Example**
......
...@@ -102,7 +102,7 @@ try { ...@@ -102,7 +102,7 @@ try {
let localUpdater = update.getLocalUpdater(); let localUpdater = update.getLocalUpdater();
} catch(error) { } catch(error) {
console.error(`Fail to get localUpdater error: ${error}`); console.error(`Fail to get localUpdater error: ${error}`);
} };
``` ```
## Updater ## Updater
...@@ -844,7 +844,7 @@ const versionDigestInfo = { ...@@ -844,7 +844,7 @@ const versionDigestInfo = {
}; };
// Options for clearing errors // Options for clearing errors
lconstet clearOptions = { const clearOptions = {
status: update.UpgradeStatus.UPGRADE_FAIL, status: update.UpgradeStatus.UPGRADE_FAIL,
}; };
updater.clearError(versionDigestInfo, clearOptions).then(() => { updater.clearError(versionDigestInfo, clearOptions).then(() => {
...@@ -1248,7 +1248,7 @@ Installs the update package. This API uses a promise to return the result. ...@@ -1248,7 +1248,7 @@ Installs the update package. This API uses a promise to return the result.
**Example** **Example**
```ts ```ts
localUpdater upgradeFiles = [{ const upgradeFiles = [{
fileType: update.ComponentType.OTA, // OTA package fileType: update.ComponentType.OTA, // OTA package
filePath: "path" // Path of the local update package filePath: "path" // Path of the local update package
}]; }];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册