• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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
16/**
17 * @file
18 * @kit DistributedServiceKit
19 */
20
21import Want from './@ohos.app.ability.Want';
22import AbilityConstant from './@ohos.app.ability.AbilityConstant';
23import type DistributedExtensionContext from './@ohos.application.DistributedExtensionContext';
24
25/**
26 * Class to be override for distributed extension ability.
27 *
28 * @syscap SystemCapability.DistributedSched.AppCollaboration
29 * @stagemodelonly
30 * @since 20
31 */
32
33export default class DistributedExtensionAbility {
34
35  /**
36   * distributed collaborative context.
37   *
38   * @type { DistributedExtensionContext }
39   * @syscap SystemCapability.DistributedSched.AppCollaboration
40   * @stagemodelonly
41   * @since 20
42   */
43  context: DistributedExtensionContext;
44
45  /**
46   * Callback when Extension is started
47   *
48   * @param { Want } want Indicates the want info of ability.
49   * @syscap SystemCapability.DistributedSched.AppCollaboration
50   * @stagemodelonly
51   * @since 20
52   */
53  onCreate(want: Want): void;
54
55  /**
56   * Callback when the distributed collaborative extension is destroyed
57   *
58   * @syscap SystemCapability.DistributedSched.AppCollaboration
59   * @stagemodelonly
60   * @since 20
61   */
62  onDestroy(): void;
63
64  /**
65   * Callback when there is a request in distributed collaboration
66   *
67   * @param { Record<string, Object> } wantParam - Indicates the want parameter.
68   * @returns { AbilityConstant.CollaborateResult } Return the result of onCollaborate.
69   * @syscap SystemCapability.DistributedSched.AppCollaboration
70   * @stagemodelonly
71   * @since 20
72   */
73  onCollaborate(wantParam: Record<string, Object>): AbilityConstant.CollaborateResult;
74}
75