提交 a224a82f 编写于 作者: H HuangXW

删除错误码汇总文档的链接,修改示例代码

Signed-off-by: NHuangXW <huangxinwei4@huawei.com>
上级 74984930
...@@ -72,7 +72,7 @@ Ability配置标签示例如下: ...@@ -72,7 +72,7 @@ Ability配置标签示例如下:
``` ```
**2. 导入Ability模块** **2. 导入Ability模块**
```ts ```ts
import Ability from '@ohos.app.ability.Ability' import Ability from '@ohos.app.ability.UIAbility'
``` ```
**3. 定义约定的序列化数据** **3. 定义约定的序列化数据**
...@@ -142,7 +142,7 @@ export default class CalleeAbility extends Ability { ...@@ -142,7 +142,7 @@ export default class CalleeAbility extends Ability {
### 访问Callee被调用端 ### 访问Callee被调用端
**1. 导入Ability模块** **1. 导入Ability模块**
```ts ```ts
import Ability from '@ohos.app.ability.Ability' import Ability from '@ohos.app.ability.UIAbility'
``` ```
**2. 获取Caller通信接口** **2. 获取Caller通信接口**
......
...@@ -46,7 +46,7 @@ Ability创建时回调,执行初始化业务逻辑操作。 ...@@ -46,7 +46,7 @@ Ability创建时回调,执行初始化业务逻辑操作。
**示例:** **示例:**
```js ```ts
class myAbility extends Ability { class myAbility extends Ability {
onCreate(want, param) { onCreate(want, param) {
console.log('onCreate, want:' + want.abilityName); console.log('onCreate, want:' + want.abilityName);
...@@ -71,7 +71,7 @@ onWindowStageCreate(windowStage: window.WindowStage): void ...@@ -71,7 +71,7 @@ onWindowStageCreate(windowStage: window.WindowStage): void
**示例:** **示例:**
```js ```ts
class myAbility extends Ability { class myAbility extends Ability {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate'); console.log('onWindowStageCreate');
...@@ -90,7 +90,7 @@ onWindowStageDestroy(): void ...@@ -90,7 +90,7 @@ onWindowStageDestroy(): void
**示例:** **示例:**
```js ```ts
class myAbility extends Ability { class myAbility extends Ability {
onWindowStageDestroy() { onWindowStageDestroy() {
console.log('onWindowStageDestroy'); console.log('onWindowStageDestroy');
...@@ -115,7 +115,7 @@ onWindowStageRestore(windowStage: window.WindowStage): void ...@@ -115,7 +115,7 @@ onWindowStageRestore(windowStage: window.WindowStage): void
**示例:** **示例:**
```js ```ts
class myAbility extends Ability { class myAbility extends Ability {
onWindowStageRestore(windowStage) { onWindowStageRestore(windowStage) {
console.log('onWindowStageRestore'); console.log('onWindowStageRestore');
...@@ -134,7 +134,7 @@ Ability生命周期回调,在销毁时回调,执行资源清理等操作。 ...@@ -134,7 +134,7 @@ Ability生命周期回调,在销毁时回调,执行资源清理等操作。
**示例:** **示例:**
```js ```ts
class myAbility extends Ability { class myAbility extends Ability {
onDestroy() { onDestroy() {
console.log('onDestroy'); console.log('onDestroy');
...@@ -153,7 +153,7 @@ Ability生命周期回调,当应用从后台转到前台时触发。 ...@@ -153,7 +153,7 @@ Ability生命周期回调,当应用从后台转到前台时触发。
**示例:** **示例:**
```js ```ts
class myAbility extends Ability { class myAbility extends Ability {
onForeground() { onForeground() {
console.log('onForeground'); console.log('onForeground');
...@@ -172,7 +172,7 @@ Ability生命周期回调,当应用从前台转到后台时触发。 ...@@ -172,7 +172,7 @@ Ability生命周期回调,当应用从前台转到后台时触发。
**示例:** **示例:**
```js ```ts
class myAbility extends Ability { class myAbility extends Ability {
onBackground() { onBackground() {
console.log('onBackground'); console.log('onBackground');
...@@ -203,7 +203,7 @@ onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; ...@@ -203,7 +203,7 @@ onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult;
**示例:** **示例:**
```js ```ts
import AbilityConstant from "@ohos.application.AbilityConstant" import AbilityConstant from "@ohos.application.AbilityConstant"
class myAbility extends Ability { class myAbility extends Ability {
onContinue(wantParams) { onContinue(wantParams) {
...@@ -232,7 +232,7 @@ onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; ...@@ -232,7 +232,7 @@ onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;
**示例:** **示例:**
```js ```ts
class myAbility extends Ability { class myAbility extends Ability {
onNewWant(want) { onNewWant(want) {
console.log('onNewWant, want:' + want.abilityName); console.log('onNewWant, want:' + want.abilityName);
...@@ -257,7 +257,7 @@ onConfigurationUpdated(config: Configuration): void; ...@@ -257,7 +257,7 @@ onConfigurationUpdated(config: Configuration): void;
**示例:** **示例:**
```js ```ts
class myAbility extends Ability { class myAbility extends Ability {
onConfigurationUpdated(config) { onConfigurationUpdated(config) {
console.log('onConfigurationUpdated, config:' + JSON.stringify(config)); console.log('onConfigurationUpdated, config:' + JSON.stringify(config));
...@@ -281,7 +281,7 @@ dump(params: Array\<string>): Array\<string>; ...@@ -281,7 +281,7 @@ dump(params: Array\<string>): Array\<string>;
**示例:** **示例:**
```js ```ts
class myAbility extends Ability { class myAbility extends Ability {
dump(params) { dump(params) {
console.log('dump, params:' + JSON.stringify(params)); console.log('dump, params:' + JSON.stringify(params));
...@@ -306,7 +306,7 @@ onMemoryLevel(level: AbilityConstant.MemoryLevel): void; ...@@ -306,7 +306,7 @@ onMemoryLevel(level: AbilityConstant.MemoryLevel): void;
**示例:** **示例:**
```js ```ts
class myAbility extends Ability { class myAbility extends Ability {
onMemoryLevel(level) { onMemoryLevel(level) {
console.log('onMemoryLevel, level:' + JSON.stringify(level)); console.log('onMemoryLevel, level:' + JSON.stringify(level));
...@@ -343,8 +343,6 @@ call(method: string, data: rpc.Sequenceable): Promise&lt;void&gt;; ...@@ -343,8 +343,6 @@ call(method: string, data: rpc.Sequenceable): Promise&lt;void&gt;;
**错误码:** **错误码:**
以下错误码的详细介绍请参见[元能力错误码](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| ------- | -------------------------------- | | ------- | -------------------------------- |
| 201 | The application does not have permission to call the interface. | | 201 | The application does not have permission to call the interface. |
...@@ -355,8 +353,8 @@ call(method: string, data: rpc.Sequenceable): Promise&lt;void&gt;; ...@@ -355,8 +353,8 @@ call(method: string, data: rpc.Sequenceable): Promise&lt;void&gt;;
**示例:** **示例:**
```js ```ts
import Ability from '@ohos.app.ability.Ability'; import Ability from '@ohos.app.ability.UIAbility';
class MyMessageAble{ // 自定义的Sequenceable数据结构 class MyMessageAble{ // 自定义的Sequenceable数据结构
name:"" name:""
str:"" str:""
...@@ -388,7 +386,7 @@ call(method: string, data: rpc.Sequenceable): Promise&lt;void&gt;; ...@@ -388,7 +386,7 @@ call(method: string, data: rpc.Sequenceable): Promise&lt;void&gt;;
deviceId: "" deviceId: ""
}).then((obj) => { }).then((obj) => {
caller = obj; caller = obj;
let msg = new MyMessageAble(1, "world"); // 参考Sequenceable数据定义 let msg = new MyMessageAble("msg", "world"); // 参考Sequenceable数据定义
caller.call(method, msg) caller.call(method, msg)
.then(() => { .then(() => {
console.log('Caller call() called'); console.log('Caller call() called');
...@@ -429,8 +427,6 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise&lt;rpc.MessagePa ...@@ -429,8 +427,6 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise&lt;rpc.MessagePa
**错误码:** **错误码:**
以下错误码的详细介绍请参见[元能力错误码](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| ------- | -------------------------------- | | ------- | -------------------------------- |
| 201 | The application does not have permission to call the interface. | | 201 | The application does not have permission to call the interface. |
...@@ -441,8 +437,8 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise&lt;rpc.MessagePa ...@@ -441,8 +437,8 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise&lt;rpc.MessagePa
**示例:** **示例:**
```js ```ts
import Ability from '@ohos.app.ability.Ability'; import Ability from '@ohos.app.ability.UIAbility';
class MyMessageAble{ class MyMessageAble{
name:"" name:""
str:"" str:""
...@@ -504,8 +500,6 @@ release(): void; ...@@ -504,8 +500,6 @@ release(): void;
**错误码:** **错误码:**
以下错误码的详细介绍请参见[元能力错误码](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| ------- | -------------------------------- | | ------- | -------------------------------- |
| 401 | Invalid input parameter. | | 401 | Invalid input parameter. |
...@@ -515,8 +509,8 @@ release(): void; ...@@ -515,8 +509,8 @@ release(): void;
**示例:** **示例:**
```js ```ts
import Ability from '@ohos.app.ability.Ability'; import Ability from '@ohos.app.ability.UIAbility';
var caller; var caller;
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
...@@ -558,8 +552,6 @@ release(): void; ...@@ -558,8 +552,6 @@ release(): void;
**错误码:** **错误码:**
以下错误码的详细介绍请参见[元能力错误码](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| ------- | -------------------------------- | | ------- | -------------------------------- |
| 401 | Invalid input parameter. | | 401 | Invalid input parameter. |
...@@ -568,8 +560,8 @@ release(): void; ...@@ -568,8 +560,8 @@ release(): void;
**示例:** **示例:**
```js ```ts
import Ability from '@ohos.app.ability.Ability'; import Ability from '@ohos.app.ability.UIAbility';
var caller; var caller;
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
...@@ -617,8 +609,6 @@ on(method: string, callback: CalleeCallBack): void; ...@@ -617,8 +609,6 @@ on(method: string, callback: CalleeCallBack): void;
**错误码:** **错误码:**
以下错误码的详细介绍请参见[元能力错误码](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| ------- | -------------------------------- | | ------- | -------------------------------- |
| 401 | Invalid input parameter. | | 401 | Invalid input parameter. |
...@@ -627,8 +617,8 @@ on(method: string, callback: CalleeCallBack): void; ...@@ -627,8 +617,8 @@ on(method: string, callback: CalleeCallBack): void;
**示例:** **示例:**
```js ```ts
import Ability from '@ohos.app.ability.Ability'; import Ability from '@ohos.app.ability.UIAbility';
class MyMessageAble{ class MyMessageAble{
name:"" name:""
str:"" str:""
...@@ -686,8 +676,6 @@ off(method: string): void; ...@@ -686,8 +676,6 @@ off(method: string): void;
**错误码:** **错误码:**
以下错误码的详细介绍请参见[元能力错误码](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| ------- | -------------------------------- | | ------- | -------------------------------- |
| 401 | Invalid input parameter. | | 401 | Invalid input parameter. |
...@@ -697,8 +685,8 @@ off(method: string): void; ...@@ -697,8 +685,8 @@ off(method: string): void;
**示例:** **示例:**
```js ```ts
import Ability from '@ohos.app.ability.Ability'; import Ability from '@ohos.app.ability.UIAbility';
var method = 'call_Function'; var method = 'call_Function';
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册