1e41f4b71Sopenharmony_ci# @ohos.bundle.overlay (overlay模块) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci本模块提供[overlay特征应用](#overlay特征应用介绍)的安装,overlay特征应用的[OverlayModuleInfo](js-apis-bundleManager-overlayModuleInfo.md)信息的查询以及overlay特征应用的禁用使能的能力。 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **说明:** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## 导入模块 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci``` ts 12e41f4b71Sopenharmony_ciimport { overlay } from '@kit.AbilityKit'; 13e41f4b71Sopenharmony_ci``` 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci## overlay.setOverlayEnabled 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_cisetOverlayEnabled(moduleName:string, isEnabled: boolean): Promise\<void> 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci以异步方法设置当前应用中overlay特征module的禁用使能状态。使用Promise异步回调。成功返回null,失败返回对应错误信息。 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci**参数:** 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 26e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | --------------------------------------- | 27e41f4b71Sopenharmony_ci| moduleName | string | 是 | overlay特征module的名称。 | 28e41f4b71Sopenharmony_ci| isEnabled | boolean | 是 | 值为true表示使能,值为false表示禁用。 | 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci**返回值:** 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci| 类型 | 说明 | 33e41f4b71Sopenharmony_ci| ------------------------- | ------------------ | 34e41f4b71Sopenharmony_ci| Promise\<void> | Promise对象。无返回结果的Promise对象。 | 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ci**错误码:** 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[ohos.bundle错误码](errorcode-bundle.md)。 39e41f4b71Sopenharmony_ci 40e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 | 41e41f4b71Sopenharmony_ci| ------ | -------------------------------------- | 42e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 43e41f4b71Sopenharmony_ci| 17700002 | The specified module name is not found. | 44e41f4b71Sopenharmony_ci| 17700033 | The specified module is not an overlay module. | 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci**示例:** 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci```ts 49e41f4b71Sopenharmony_ciimport { overlay } from '@kit.AbilityKit'; 50e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 51e41f4b71Sopenharmony_ci 52e41f4b71Sopenharmony_cilet moduleName = "feature"; 53e41f4b71Sopenharmony_cilet isEnabled = false; 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_citry { 56e41f4b71Sopenharmony_ci overlay.setOverlayEnabled(moduleName, isEnabled) 57e41f4b71Sopenharmony_ci .then(() => { 58e41f4b71Sopenharmony_ci console.info('setOverlayEnabled success'); 59e41f4b71Sopenharmony_ci }).catch((err: BusinessError) => { 60e41f4b71Sopenharmony_ci console.info('setOverlayEnabled failed due to err code: ' + err.code + ' ' + 'message:' + err.message); 61e41f4b71Sopenharmony_ci }); 62e41f4b71Sopenharmony_ci} catch (err) { 63e41f4b71Sopenharmony_ci let code = (err as BusinessError).code; 64e41f4b71Sopenharmony_ci let message = (err as BusinessError).message; 65e41f4b71Sopenharmony_ci console.info('setOverlayEnabled failed due to err code: ' + code + ' ' + 'message:' + message); 66e41f4b71Sopenharmony_ci} 67e41f4b71Sopenharmony_ci``` 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_ci## overlay.setOverlayEnabled 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_cisetOverlayEnabled(moduleName:string, isEnabled: boolean, callback: AsyncCallback\<void>): void 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_ci以异步方法设置当前应用中overlay module的禁用使能状态。使用callback异步回调。成功返回null,失败返回对应错误信息。 74e41f4b71Sopenharmony_ci 75e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_ci**参数:** 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 80e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | --------------------------------------- | 81e41f4b71Sopenharmony_ci| moduleName | string | 是 | overlay特征module的名称。 | 82e41f4b71Sopenharmony_ci| isEnabled | boolean | 是 | 值为true表示使能,值为false表示禁用。| 83e41f4b71Sopenharmony_ci| callback | AsyncCallback\<void> | 是 | 回调函数,当设置指定module的overlay禁用使能状态成功时,err为null,否则为错误对象。 | 84e41f4b71Sopenharmony_ci 85e41f4b71Sopenharmony_ci**错误码:** 86e41f4b71Sopenharmony_ci 87e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[ohos.bundle错误码](errorcode-bundle.md)。 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 | 90e41f4b71Sopenharmony_ci| ------ | -------------------------------------- | 91e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 92e41f4b71Sopenharmony_ci| 17700002 | The specified module name is not found. | 93e41f4b71Sopenharmony_ci| 17700033 | The specified module is not an overlay module. | 94e41f4b71Sopenharmony_ci 95e41f4b71Sopenharmony_ci**示例:** 96e41f4b71Sopenharmony_ci 97e41f4b71Sopenharmony_ci```ts 98e41f4b71Sopenharmony_ciimport { overlay } from '@kit.AbilityKit'; 99e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 100e41f4b71Sopenharmony_ci 101e41f4b71Sopenharmony_cilet moduleName = "feature"; 102e41f4b71Sopenharmony_cilet isEnabled = false; 103e41f4b71Sopenharmony_ci 104e41f4b71Sopenharmony_citry { 105e41f4b71Sopenharmony_ci overlay.setOverlayEnabled(moduleName, isEnabled, (err, data) => { 106e41f4b71Sopenharmony_ci if (err) { 107e41f4b71Sopenharmony_ci console.info('setOverlayEnabled failed due to err code: ' + err.code + ' ' + 'message:' + err.message); 108e41f4b71Sopenharmony_ci return; 109e41f4b71Sopenharmony_ci } 110e41f4b71Sopenharmony_ci console.info('setOverlayEnabled success'); 111e41f4b71Sopenharmony_ci }); 112e41f4b71Sopenharmony_ci} catch (err) { 113e41f4b71Sopenharmony_ci let code = (err as BusinessError).code; 114e41f4b71Sopenharmony_ci let message = (err as BusinessError).message; 115e41f4b71Sopenharmony_ci console.info('setOverlayEnabled failed due to err code: ' + code + ' ' + 'message:' + message); 116e41f4b71Sopenharmony_ci} 117e41f4b71Sopenharmony_ci``` 118e41f4b71Sopenharmony_ci 119e41f4b71Sopenharmony_ci## overlay.getOverlayModuleInfo 120e41f4b71Sopenharmony_ci 121e41f4b71Sopenharmony_cigetOverlayModuleInfo(moduleName: string): Promise\<OverlayModuleInfo> 122e41f4b71Sopenharmony_ci 123e41f4b71Sopenharmony_ci以异步方法获取当前应用中指定的module的overlayModuleInfo信息。使用promise异步回调,成功返回null,失败返回对应错误信息。 124e41f4b71Sopenharmony_ci 125e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay 126e41f4b71Sopenharmony_ci 127e41f4b71Sopenharmony_ci**参数:** 128e41f4b71Sopenharmony_ci 129e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 130e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | ------------------------------------------ | 131e41f4b71Sopenharmony_ci| moduleName | string | 是 | 指定当前应用中的overlay module的名称。 | 132e41f4b71Sopenharmony_ci 133e41f4b71Sopenharmony_ci**返回值:** 134e41f4b71Sopenharmony_ci 135e41f4b71Sopenharmony_ci| 类型 | 说明 | 136e41f4b71Sopenharmony_ci| ------------------------- | ------------------ | 137e41f4b71Sopenharmony_ci| Promise\<[OverlayModuleInfo](js-apis-bundleManager-overlayModuleInfo.md)> | Promise对象,返回[OverlayModuleInfo](js-apis-bundleManager-overlayModuleInfo.md)。| 138e41f4b71Sopenharmony_ci 139e41f4b71Sopenharmony_ci**错误码:** 140e41f4b71Sopenharmony_ci 141e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[ohos.bundle错误码](errorcode-bundle.md)。 142e41f4b71Sopenharmony_ci 143e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 | 144e41f4b71Sopenharmony_ci| ------ | -------------------------------------- | 145e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 146e41f4b71Sopenharmony_ci| 17700002 | The specified module name is not found. | 147e41f4b71Sopenharmony_ci| 17700032 | The specified bundle does not contain any overlay module. | 148e41f4b71Sopenharmony_ci| 17700033 | The specified module is not an overlay module. | 149e41f4b71Sopenharmony_ci 150e41f4b71Sopenharmony_ci**示例:** 151e41f4b71Sopenharmony_ci 152e41f4b71Sopenharmony_ci```ts 153e41f4b71Sopenharmony_ciimport { overlay } from '@kit.AbilityKit'; 154e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 155e41f4b71Sopenharmony_ci 156e41f4b71Sopenharmony_cilet moduleName = "feature"; 157e41f4b71Sopenharmony_ci 158e41f4b71Sopenharmony_ci(async () => { 159e41f4b71Sopenharmony_ci try { 160e41f4b71Sopenharmony_ci let overlayModuleInfo = await overlay.getOverlayModuleInfo(moduleName); 161e41f4b71Sopenharmony_ci console.log('overlayModuleInfo is ' + JSON.stringify(overlayModuleInfo)); 162e41f4b71Sopenharmony_ci } catch (err) { 163e41f4b71Sopenharmony_ci let code = (err as BusinessError).code; 164e41f4b71Sopenharmony_ci let message = (err as BusinessError).message; 165e41f4b71Sopenharmony_ci console.log('getOverlayModuleInfo failed due to err code : ' + code + ' ' + 'message :' + message); 166e41f4b71Sopenharmony_ci } 167e41f4b71Sopenharmony_ci})(); 168e41f4b71Sopenharmony_ci``` 169e41f4b71Sopenharmony_ci 170e41f4b71Sopenharmony_ci## overlay.getOverlayModuleInfo 171e41f4b71Sopenharmony_ci 172e41f4b71Sopenharmony_cigetOverlayModuleInfo(moduleName: string, callback: AsyncCallback\<OverlayModuleInfo>): void 173e41f4b71Sopenharmony_ci 174e41f4b71Sopenharmony_ci以异步方法获取当前应用中指定的module的overlayModuleInfo信息。使用callback异步回调,成功返回null,失败返回对应错误信息。 175e41f4b71Sopenharmony_ci 176e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay 177e41f4b71Sopenharmony_ci 178e41f4b71Sopenharmony_ci**参数:** 179e41f4b71Sopenharmony_ci 180e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 181e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | --------------------------------------- | 182e41f4b71Sopenharmony_ci| moduleName | string | 是 | 指定当前应用中的overlay特征module的名称。 | 183e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[OverlayModuleInfo](js-apis-bundleManager-overlayModuleInfo.md)> | 是 | 回调函数,当获取当前应用中指定的module的[OverlayModuleInfo](js-apis-bundleManager-overlayModuleInfo.md)信息成功时,err返回null。否则回调函数返回具体错误对象。 | 184e41f4b71Sopenharmony_ci 185e41f4b71Sopenharmony_ci**错误码:** 186e41f4b71Sopenharmony_ci 187e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[ohos.bundle错误码](errorcode-bundle.md)。 188e41f4b71Sopenharmony_ci 189e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 | 190e41f4b71Sopenharmony_ci| ------ | -------------------------------------- | 191e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 192e41f4b71Sopenharmony_ci| 17700002 | The specified module name is not found. | 193e41f4b71Sopenharmony_ci| 17700032 | The specified bundle does not contain any overlay module. | 194e41f4b71Sopenharmony_ci| 17700033 | The specified module is not an overlay module. | 195e41f4b71Sopenharmony_ci 196e41f4b71Sopenharmony_ci**示例:** 197e41f4b71Sopenharmony_ci 198e41f4b71Sopenharmony_ci```ts 199e41f4b71Sopenharmony_ciimport { overlay } from '@kit.AbilityKit'; 200e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 201e41f4b71Sopenharmony_ci 202e41f4b71Sopenharmony_cilet moduleName = "feature"; 203e41f4b71Sopenharmony_ci 204e41f4b71Sopenharmony_citry { 205e41f4b71Sopenharmony_ci overlay.getOverlayModuleInfo(moduleName, (err, data) => { 206e41f4b71Sopenharmony_ci if (err) { 207e41f4b71Sopenharmony_ci console.log('getOverlayModuleInfo failed due to err code : ' + err.code + ' ' + 'message :' + err.message); 208e41f4b71Sopenharmony_ci return; 209e41f4b71Sopenharmony_ci } 210e41f4b71Sopenharmony_ci console.log('overlayModuleInfo is ' + JSON.stringify(data)); 211e41f4b71Sopenharmony_ci }); 212e41f4b71Sopenharmony_ci} catch (err) { 213e41f4b71Sopenharmony_ci let code = (err as BusinessError).code; 214e41f4b71Sopenharmony_ci let message = (err as BusinessError).message; 215e41f4b71Sopenharmony_ci console.log('getOverlayModuleInfo failed due to err code : ' + code + ' ' + 'message :' + message); 216e41f4b71Sopenharmony_ci} 217e41f4b71Sopenharmony_ci``` 218e41f4b71Sopenharmony_ci 219e41f4b71Sopenharmony_ci## overlay.getTargetOverlayModuleInfos 220e41f4b71Sopenharmony_ci 221e41f4b71Sopenharmony_cigetTargetOverlayModuleInfos(targetModuleName: string): Promise\<Array\<OverlayModuleInfo>> 222e41f4b71Sopenharmony_ci 223e41f4b71Sopenharmony_ci以异步方法获取指定的目标module的OverlayModuleInfo。使用promise异步回调,成功返回null,失败返回对应错误信息。 224e41f4b71Sopenharmony_ci 225e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay 226e41f4b71Sopenharmony_ci 227e41f4b71Sopenharmony_ci**参数:** 228e41f4b71Sopenharmony_ci 229e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 230e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | --------------------------------------- | 231e41f4b71Sopenharmony_ci| targetModuleName | string | 是 | 指定当前应用中的目标module的名称。 | 232e41f4b71Sopenharmony_ci 233e41f4b71Sopenharmony_ci**返回值:** 234e41f4b71Sopenharmony_ci 235e41f4b71Sopenharmony_ci| 类型 | 说明 | 236e41f4b71Sopenharmony_ci| ------------------------------------------------------------ | ------------------------------------------------------------ | 237e41f4b71Sopenharmony_ci| Promise\<Array\<[OverlayModuleInfo](js-apis-bundleManager-overlayModuleInfo.md)>> | Promise对象,返回\<Array\<[OverlayModuleInfo](js-apis-bundleManager-overlayModuleInfo.md)>>。 | 238e41f4b71Sopenharmony_ci 239e41f4b71Sopenharmony_ci**错误码:** 240e41f4b71Sopenharmony_ci 241e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[ohos.bundle错误码](errorcode-bundle.md)。 242e41f4b71Sopenharmony_ci 243e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 | 244e41f4b71Sopenharmony_ci| ------ | -------------------------------------- | 245e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 246e41f4b71Sopenharmony_ci| 17700002 | The specified module name is not found. | 247e41f4b71Sopenharmony_ci| 17700034 | The specified module is an overlay module. | 248e41f4b71Sopenharmony_ci 249e41f4b71Sopenharmony_ci**示例:** 250e41f4b71Sopenharmony_ci 251e41f4b71Sopenharmony_ci```ts 252e41f4b71Sopenharmony_ciimport { overlay } from '@kit.AbilityKit'; 253e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 254e41f4b71Sopenharmony_ci 255e41f4b71Sopenharmony_cilet targetModuleName = "feature"; 256e41f4b71Sopenharmony_ci 257e41f4b71Sopenharmony_ci(async () => { 258e41f4b71Sopenharmony_ci try { 259e41f4b71Sopenharmony_ci let overlayModuleInfos = await overlay.getTargetOverlayModuleInfos(targetModuleName); 260e41f4b71Sopenharmony_ci console.log('overlayModuleInfos are ' + JSON.stringify(overlayModuleInfos)); 261e41f4b71Sopenharmony_ci } catch (err) { 262e41f4b71Sopenharmony_ci let code = (err as BusinessError).code; 263e41f4b71Sopenharmony_ci let message = (err as BusinessError).message; 264e41f4b71Sopenharmony_ci console.log('getTargetOverlayModuleInfos failed due to err code : ' + code + ' ' + 'message :' + message); 265e41f4b71Sopenharmony_ci } 266e41f4b71Sopenharmony_ci})(); 267e41f4b71Sopenharmony_ci``` 268e41f4b71Sopenharmony_ci 269e41f4b71Sopenharmony_ci## overlay.getTargetOverlayModuleInfos 270e41f4b71Sopenharmony_ci 271e41f4b71Sopenharmony_cigetTargetOverlayModuleInfos(targetModuleName: string, callback: AsyncCallback\<Array\<OverlayModuleInfo>>): void 272e41f4b71Sopenharmony_ci 273e41f4b71Sopenharmony_ci以异步方法获取指定的目标module的OverlayModuleInfo。使用callback异步回调,成功返回null,失败返回对应错误信息。 274e41f4b71Sopenharmony_ci 275e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay 276e41f4b71Sopenharmony_ci 277e41f4b71Sopenharmony_ci**参数:** 278e41f4b71Sopenharmony_ci 279e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 280e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | --------------------------------------- | 281e41f4b71Sopenharmony_ci| targetModuleName | string | 是 | 指定当前应用中的目标module的名称。 | 282e41f4b71Sopenharmony_ci| callback | AsyncCallback\<Array\<[OverlayModuleInfo](js-apis-bundleManager-overlayModuleInfo.md)>> | 是 | 回调函数,当获取指定的目标module的[OverlayModuleInfo](js-apis-bundleManager-overlayModuleInfo.md)成功时,err返回null。否则回调函数返回具体错误对象。 | 283e41f4b71Sopenharmony_ci 284e41f4b71Sopenharmony_ci**错误码:** 285e41f4b71Sopenharmony_ci 286e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[ohos.bundle错误码](errorcode-bundle.md)。 287e41f4b71Sopenharmony_ci 288e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 | 289e41f4b71Sopenharmony_ci| ------ | -------------------------------------- | 290e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 291e41f4b71Sopenharmony_ci| 17700002 | The specified module name is not found. | 292e41f4b71Sopenharmony_ci| 17700034 | The specified module is an overlay module. | 293e41f4b71Sopenharmony_ci 294e41f4b71Sopenharmony_ci**示例:** 295e41f4b71Sopenharmony_ci 296e41f4b71Sopenharmony_ci```ts 297e41f4b71Sopenharmony_ciimport { overlay } from '@kit.AbilityKit'; 298e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 299e41f4b71Sopenharmony_ci 300e41f4b71Sopenharmony_cilet targetModuleName = "feature"; 301e41f4b71Sopenharmony_ci 302e41f4b71Sopenharmony_citry { 303e41f4b71Sopenharmony_ci overlay.getTargetOverlayModuleInfos(targetModuleName, (err, data) => { 304e41f4b71Sopenharmony_ci if (err) { 305e41f4b71Sopenharmony_ci console.log('getTargetOverlayModuleInfos failed due to err code : ' + err.code + ' ' + 'message :' + err.message); 306e41f4b71Sopenharmony_ci return; 307e41f4b71Sopenharmony_ci } 308e41f4b71Sopenharmony_ci console.log('overlayModuleInfo is ' + JSON.stringify(data)); 309e41f4b71Sopenharmony_ci }); 310e41f4b71Sopenharmony_ci} catch (err) { 311e41f4b71Sopenharmony_ci let code = (err as BusinessError).code; 312e41f4b71Sopenharmony_ci let message = (err as BusinessError).message; 313e41f4b71Sopenharmony_ci console.log('getTargetOverlayModuleInfos failed due to err code : ' + code + ' ' + 'message :' + message); 314e41f4b71Sopenharmony_ci} 315e41f4b71Sopenharmony_ci``` 316e41f4b71Sopenharmony_ci 317e41f4b71Sopenharmony_ci## overlay特征应用介绍 318e41f4b71Sopenharmony_ci 319e41f4b71Sopenharmony_ci**概念** 320e41f4b71Sopenharmony_cioverlay特征应用指的是应用中包含有overlay特征的module。该特征module一般是为设备上存在的非overlay特征的module提供额外的资源文件,以便于目标module在运行阶段可以使用这些额外的资源文件来展示不同的颜色,标签,主题等等。overlay特征仅适用于stage模型。 321e41f4b71Sopenharmony_ci 322e41f4b71Sopenharmony_ci**如何识别overlay特征的module** 323e41f4b71Sopenharmony_ci在IDE中创建应用工程时, module的配置文件module.json5中包含targetModuleName和targetPriority字段时,该module将会在安装阶段被识别为overlay特征的module。 324