• 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## Modules to Import
10
11```ts
12import common from '@ohos.app.ability.common';
13```
14
15**System capability**: SystemCapability.Ability.AbilityRuntime.Core
16
17| Name      | Type  | Readable  | Writable  | Description     |
18| -------- | ------ | ---- | ---- | ------- |
19| stageMode | boolean | Yes   | Yes   | Whether the child class **Context** is used for the stage model.|
20
21**Example**
22
23Take the stage model as an example. You can access the **stageMode** field through **UIAbilityContext**.
24
25```ts
26import UIAbility from '@ohos.app.ability.UIAbility';
27
28class MainAbility extends UIAbility {
29    onCreate(want, launchParam) {
30        // MainAbility onCreate, isStageMode: true
31        console.log('MainAbility onCreate, isStageMode: ' + this.context.stageMode);
32    }
33}
34```
35