• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# BaseContext
2
3**BaseContext** is an abstract class that specifies whether a child class **Context** is used for the stage model or FA model. It is the parent class for all types of **Context**.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8
9**System capability**: SystemCapability.Ability.AbilityRuntime.Core
10
11| Name      | Type  | Readable  | Writable  | Description     |
12| -------- | ------ | ---- | ---- | ------- |
13| stageMode | boolean | Yes   | Yes   | Whether the child class **Context** is used for the stage model.<br>**true**: used for the stage model.<br>**false**: used for the FA model.|
14
15**Example**
16
17Take the stage model as an example. You can access the **stageMode** field through **UIAbilityContext**.
18
19```ts
20import UIAbility from '@ohos.app.ability.UIAbility';
21
22class MainAbility extends UIAbility {
23    onCreate(want, launchParam) {
24        // MainAbility onCreate, isStageMode: true
25        console.log('MainAbility onCreate, isStageMode: ' + this.context.stageMode);
26    }
27}
28```
29