changelog-resourceschedule.md 1.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
# Resource Scheduler Subsystem Changelog

## cl.resourceschedule.workScheduler 

The WorkSchedulerExtensionAbility provides a default WorkSchedulerExtensionContext.

**Change Impact**

Applications developed based on OpenHarmony4.0.5.1 and later SDK versions can use the default context attribute as the context environment of a WorkSchedulerExtension.

**Key API/Component Changes**

The context attribute is added to **@ohos.WorkSchedulerExtensionAbility.d.ts**. The **application/WorkSchedulerExtensionContext.d.ts** file is added, which is inherited from ExtensionContext.

| Module| Class| Method/Attribute/Enum/Constant| Change Type| 
|  -- | -- | -- | -- |
| @ohos.WorkSchedulerExtensionAbility.d.ts | WorkSchedulerExtensionAbility | context: WorkSchedulerExtensionContext; | Added| 
| application/WorkSchedulerExtensionContext.d.ts | WorkSchedulerExtensionContext | - | Added| 

**Adaptation Guide**

The context is obtained through a WorkSchedulerExtensionAbility child class instance.

```ts
import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility';

class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
    onWorkStart(workInfo) {
        let WorkSchedulerExtensionContext = this.context; // Obtain the WorkSchedulerExtensionContext.
    }
}
```