openharmony 鸿蒙 js-apis-inner-application-driverExtensionContext

2025-06-12 浏览 (1)

DriverExtensionContext

The DriverExtensionContext module provides the context of DriverExtensionAbility. It inherits from ExtensionContext.

The DriverExtensionContext module provides the operations that need to be actively initiated in the DriverExtensionAbility implementation.

NOTE

  • The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
  • The APIs of this module can be used only in the stage model.

Modules to Import

import { common } from '@kit.AbilityKit';

How to Use

Before using DriverExtensionContext, you need to obtain it through a DriverExtensionAbility child class instance.

  import { DriverExtensionAbility, DriverExtensionContext } from '@kit.DriverDevelopmentKit';

  let context : DriverExtensionContext|undefined;
  class EntryAbility extends DriverExtensionAbility {
    onInit() {
      context = this.context; // Obtain DriverExtensionContext.
    }
  }

DriverExtensionContext.updateDriverState

updateDriverState(): void;

Updates the driver state. This interface is reserved and does not provide specific functionality currently.

System capability: SystemCapability.Driver.ExternalDevice

Example

if (context != null) {
  context.updateDriverState();
}

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Driver Development Kit

harmony 鸿蒙Base DDK

harmony 鸿蒙DDK_Ashmem

harmony 鸿蒙Hid_AbsAxesArray

harmony 鸿蒙Hid_Device

harmony 鸿蒙Hid_EmitItem

harmony 鸿蒙Hid_EventProperties

harmony 鸿蒙Hid_EventTypeArray

harmony 鸿蒙Hid_KeyCodeArray

harmony 鸿蒙Hid_MscEventArray

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/KcmF1x