1/* 2 * Copyright (C) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15import { hilog } from '@kit.PerformanceAnalysisKit'; 16import { BusinessError, commonEventManager } from '@kit.BasicServicesKit'; 17 18@Entry 19@Component 20struct HostInstance { 21 aboutToAppear() { 22 hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility HostInstance aboutToAppear'); 23 24 } 25 26 @State message: string = 'ni' 27 private want1: Want = { 28 bundleName: 'com.example.act_embeddeduiextension', 29 abilityName: 'EmbeddedUIExtAbilityBundle', 30 moduleName: 'entry_test', 31 parameters: { 32 'ohos.extension.processMode.hostInstance': {} 33 } 34 } 35 36 build() { 37 Row() { 38 Column() { 39 Text(this.message).fontSize(30) 40 EmbeddedComponent(this.want1, EmbeddedType.EMBEDDED_UI_EXTENSION) 41 .width('100%') 42 .height('90%') 43 .onTerminated((info: TerminationInfo) => { 44 this.message = 'Terminarion: code = ' + info.code + ', want = ' + JSON.stringify(info.want); 45 }) 46 .onError((error: BusinessError) => { 47 this.message = 'Error: code = ' + error.code; 48 console.log('EmbeddedAbility4', JSON.stringify(error)) 49 }) 50 EmbeddedComponent(this.want1, EmbeddedType.EMBEDDED_UI_EXTENSION) 51 .width('100%') 52 .height('90%') 53 .onTerminated((info: TerminationInfo) => { 54 this.message = 'Terminarion: code = ' + info.code + ', want = ' + JSON.stringify(info.want); 55 }) 56 .onError((error: BusinessError) => { 57 this.message = 'Error: code = ' + error.code; 58 console.log('EmbeddedAbility4', JSON.stringify(error)) 59 }) 60 EmbeddedComponent(this.want1, EmbeddedType.EMBEDDED_UI_EXTENSION) 61 .width('100%') 62 .height('90%') 63 .onTerminated((info: TerminationInfo) => { 64 this.message = 'Terminarion: code = ' + info.code + ', want = ' + JSON.stringify(info.want); 65 }) 66 .onError((error: BusinessError) => { 67 this.message = 'Error: code = ' + error.code; 68 console.log('EmbeddedAbility4', JSON.stringify(error)) 69 }) 70 } 71 .width('100%') 72 } 73 .height('100%') 74 } 75}