提交 a80e8661 编写于 作者: G Gloria

update docs against 8811

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 a3104368
...@@ -20,7 +20,7 @@ import Want from '@ohos.application.Want'; ...@@ -20,7 +20,7 @@ import Want from '@ohos.application.Want';
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | | ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| deviceId | Read only | string | No | ID of the device running the ability. | | deviceId | Read only | string | No | ID of the device running the ability. |
| bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability.| | bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability.|
| abilityName | Read only | string | No | Name of the ability. If both **package** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability. The value of **abilityName** must be unique in an application.| | abilityName | Read only | string | No | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability. The value of **abilityName** must be unique in an application.|
| uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| | uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.|
| type | Read only | string | No | MIME type, that is, the type of the file to open, for example, **text/xml** and **image/***. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. | | type | Read only | string | No | MIME type, that is, the type of the file to open, for example, **text/xml** and **image/***. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. |
| flags | Read only | number | No | How the **Want** object will be handled. For details, see [flags](js-apis-featureAbility.md#flags).| | flags | Read only | number | No | How the **Want** object will be handled. For details, see [flags](js-apis-featureAbility.md#flags).|
...@@ -73,29 +73,32 @@ import Want from '@ohos.application.Want'; ...@@ -73,29 +73,32 @@ import Want from '@ohos.application.Want';
- Passing **RemoteObject** data - Passing **RemoteObject** data
``` js ``` js
import rpc from '@ohos.rpc';
import Ability from '@ohos.application.Ability'
class Stub extends rpc.RemoteObject { class Stub extends rpc.RemoteObject {
constructor(des) { constructor(des) {
if (typeof des == 'string') { if (typeof des == 'string') {
super(des); super(des);
} else { } else {
return null; return null;
} }
} }
onRemoteRequest(code, data, reply, option) { onRemoteRequest(code, data, reply, option) {
if (code === 1) { if (code === 1) {
console.log('onRemoteRequest called') console.log('onRemoteRequest called')
let token = data.readInterfaceToken(); let token = data.readInterfaceToken();
let num = data.readInt(); let num = data.readInt();
this.method(); this.method();
return true; return true;
} }
return false; return false;
} }
method() { method() {
console.log('method called'); console.log('method called');
} }
} }
var remoteObject = new Stub('want-test'); var remoteObject = new Stub('want-test');
...@@ -103,15 +106,16 @@ import Want from '@ohos.application.Want'; ...@@ -103,15 +106,16 @@ import Want from '@ohos.application.Want';
"deviceId": "", // An empty deviceId indicates the local device. "deviceId": "", // An empty deviceId indicates the local device.
"bundleName": "com.extreme.test", "bundleName": "com.extreme.test",
"abilityName": "MainAbility", "abilityName": "MainAbility",
"moduleName": "entry" // moduleName is optional. "moduleName": "entry", // moduleName is optional.
"parameters": { "parameters": {
"keyRemoteObject":{"type":"RemoteObject", "value":remoteObject} "keyRemoteObject":{"type":"RemoteObject", "value":remoteObject}
} }
}; };
this.context.startAbility(want, (error) => { this.context.startAbility(want, (error) => {
// Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability.
console.log("error.code = " + error.code) console.log("error.code = " + error.code)
}) })
```
<!--no_check--> ```
\ No newline at end of file <!--no_check-->
...@@ -33,14 +33,8 @@ var observer = { ...@@ -33,14 +33,8 @@ var observer = {
console.log('onUnhandledException, errorMsg: ', errorMsg) console.log('onUnhandledException, errorMsg: ', errorMsg)
} }
} }
errorManager.registerErrorObserver(observer) const registerErrorObserverNumber=errorManager.registerErrorObserver(observer)
.then((data) => { console.info(registerErrorObserverNumber)
console.log('----------- registerErrorObserver success ----------', data);
})
.catch((err) => {
console.log('----------- registerErrorObserver fail ----------', err);
})
``` ```
## ErrorManager.unregisterErrorObserver ## ErrorManager.unregisterErrorObserver
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册