interface_sdk-js/api/@ohos.application.FormExtension.d.ts
yangzk 6fdafac6d4 IssueNo: #I5RT32
Description: fix import
Sig: SIG_ApplicationFramework
Feature or Bugfix: Feature
Binary Source: No

Signed-off-by: yangzk <yangzhongkai@huawei.com>
Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14
2022-10-17 22:01:23 +08:00

156 lines
5.7 KiB
TypeScript

/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import formBindingData from './@ohos.app.form.formBindingData';
import formInfo from "./@ohos.application.formInfo";
import FormExtensionContext from "./application/FormExtensionContext";
import Want from './@ohos.application.Want';
import { Configuration } from './@ohos.application.Configuration';
/**
* class of form extension.
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @StageModelOnly
* @deprecated since 9
* @useinstead ohos.app.form.FormExtensionAbility
*/
export default class FormExtension {
/**
* Indicates form extension context.
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @StageModelOnly
*/
context: FormExtensionContext;
/**
* Called to return a {@link formBindingData#FormBindingData} object.
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @param want Indicates the detailed information for creating a {@link formBindingData#FormBindingData}.
* The {@code Want} object must include the form ID, form name, and grid style of the form.
* Such form information must be managed as persistent data for further form
* acquisition, update, and deletion.
* @return Returns the created {@link formBindingData#FormBindingData} object.
* @StageModelOnly
*/
onCreate(want: Want): formBindingData.FormBindingData;
/**
* Called when the form provider is notified that a temporary form is successfully converted to a normal form.
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @param formId Indicates the ID of the form.
* @return -
* @StageModelOnly
*/
onCastToNormal(formId: string): void;
/**
* Called to notify the form provider to update a specified form.
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @param formId Indicates the ID of the form to update.
* @return -
* @StageModelOnly
*/
onUpdate(formId: string): void;
/**
* Called when the form provider receives form events from the system.
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @param newStatus Indicates the form events occurred. The key in the {@code Map} object indicates the form ID,
* and the value indicates the event type, which can be either {@link formInfo#VisibilityType#FORM_VISIBLE}
* or {@link formInfo#VisibilityType#FORM_INVISIBLE}. {@link formInfo#VisibilityType#FORM_VISIBLE}
* means that the form becomes visible, and {@link formInfo#VisibilityType#FORM_INVISIBLE}
* means that the form becomes invisible.
* @return -
* @StageModelOnly
*/
onVisibilityChange(newStatus: { [key: string]: number }): void;
/**
* Called when a specified message event defined by the form provider is triggered. This method is valid only for
* JS forms.
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @param formId Indicates the ID of the form on which the message event is triggered, which is provided by
* the client to the form provider.
* @param message Indicates the value of the {@code params} field of the message event. This parameter is
* used to identify the specific component on which the event is triggered.
* @return -
* @StageModelOnly
*/
onEvent(formId: string, message: string): void;
/**
* Called to notify the form provider that a specified form has been destroyed. Override this method if
* you want your application, as the form provider, to be notified of form deletion.
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @param formId Indicates the ID of the destroyed form.
* @return -
* @StageModelOnly
*/
onDestroy(formId: string): void;
/**
* Called when the system configuration is updated.
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @param configuration Indicates the system configuration, such as language and color mode.
* @return -
* @StageModelOnly
*/
onConfigurationUpdated(config: Configuration): void;
/**
* Called to return a {@link FormState} object.
*
* <p>You must override this callback if you want this ability to return the actual form state. Otherwise,
* this method returns {@link FormState#DEFAULT} by default.</p>
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @param want Indicates the description of the form for which the {@link formInfo#FormState} is obtained.
* The description covers the bundle name, ability name, module name, form name, and form dimensions.
* @return Returns the {@link formInfo#FormState} object.
* @StageModelOnly
*/
onAcquireFormState?(want: Want): formInfo.FormState;
/**
* Called when the system shares the form.
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @param formId Indicates the ID of the form.
* @systemapi hide for inner use.
* @return Returns the wantParams object.
* @StageModelOnly
*/
onShare?(formId: string): {[key: string]: any};
}