• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 { EmbeddedUIExtensionAbility, UIExtensionContentSession, Want } from '@kit.AbilityKit';
16import { hilog } from '@kit.PerformanceAnalysisKit';
17import { commonEventManager } from '@kit.BasicServicesKit';
18
19import { bundleManager } from '@kit.AbilityKit';
20
21const TAG: string = '[ExampleEmbeddedAbility]'
22
23export default class ExampleEmbeddedAbility extends EmbeddedUIExtensionAbility {
24  onCreate() {
25    console.log(TAG, `onCreatebd2===`)
26  }
27
28  onForeground() {
29
30    hilog.info(0x0000, 'testTag', `onForeground`)
31  }
32
33  onBackground() {
34    hilog.info(0x0000, 'testTag', `onBackground`)
35
36  }
37
38  onDestroy() {
39    hilog.info(0x0000, 'testTag', `onDestroy`)
40  }
41
42  onSessionCreate(want: Want, session: UIExtensionContentSession) {
43    console.log(TAG, `onSessionCreate, want: ${JSON.stringify(want)}`);
44    let param: Record<string, UIExtensionContentSession> = {
45      'session': session
46    };
47    let storage: LocalStorage = new LocalStorage(param);
48    session.loadContent('EmbeddedUIExtAbilityBundle2/pages/BundlePageNext', storage);
49  }
50
51  onSessionDestroy(session: UIExtensionContentSession) {
52    console.log(TAG, `onSessionDestroy`);
53  }
54}