• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.app.ability.ChildProcess (Child Process Base Class)
2<!--Kit: Ability Kit-->
3<!--Subsystem: Ability-->
4<!--Owner: @SKY2001-->
5<!--Designer: @jsjzju-->
6<!--Tester: @lixueqing513-->
7<!--Adviser: @huipeizi-->
8
9ChildProcess is the base class for you to customize child processes. When starting a child process through [childProcessManager](js-apis-app-ability-childProcessManager.md), you must inherit this class and override the entrypoint method.
10
11> **NOTE**
12>
13> The initial APIs of this module are supported since API version 11. Newly added APIs will be marked with a superscript to indicate their earliest API version.
14>
15> The APIs of this module can be used only in the stage model.
16
17## Modules to Import
18
19```ts
20import { ChildProcess } from '@kit.AbilityKit';
21```
22
23## ChildProcess.onStart
24
25onStart(args?: ChildProcessArgs): void
26
27Entrypoint method of the child process. This callback is triggered when the child process is started through [childProcessManager](js-apis-app-ability-childProcessManager.md).
28
29**System capability**: SystemCapability.Ability.AbilityRuntime.Core
30
31**Parameters**
32
33  | Name| Type| Mandatory| Description|
34  | -------- | -------- | -------- | -------- |
35  | args<sup>12+</sup> | [ChildProcessArgs](js-apis-app-ability-childProcessArgs.md) | No| Parameters transferred to the child process.|
36
37**Example**
38```ts
39import { ChildProcess, ChildProcessArgs } from '@kit.AbilityKit';
40
41export default class DemoProcess extends ChildProcess {
42
43  onStart(args?: ChildProcessArgs) {
44    let entryParams = args?.entryParams;
45    let fd = args?.fds?.key1;
46    // ..
47  }
48}
49```
50