• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 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 */
15
16import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility'
17import WindowManager from '../manager/WindowManager'
18import { Logger } from '@ohos/base'
19import { WINDOW_NAMES, WINDOW_PAGES } from '../manager/WindowManager'
20
21export default class MainAbility extends ServiceExtensionAbility {
22  private windowManager: WindowManager = undefined
23
24  onCreate(want) {
25    Logger.info('[MainAbility]', 'onCreate')
26    this.initLauncher()
27  }
28
29  async initLauncher() {
30    this.windowManager = new WindowManager(this.context)
31    this.windowManager.registerWindowEvent()
32    await this.windowManager.showOrCreateWindow(WINDOW_NAMES.HOME, WINDOW_PAGES.HOME, false)
33  }
34
35  onDestroy() {
36    Logger.info('[MainAbility]', 'onDestroy')
37  }
38
39  onRequest(want, startId) {
40    Logger.info('[MainAbility]', `onRequest, want:${want.abilityName}`)
41  }
42}
43