mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-07 06:03:30 +00:00
Description: 支持启动框架4
IssueNo: #I9ALMU Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk <yangzhongkai@huawei.com> Change-Id: Ic374fcd79bce0d0727991390f32646fd5a452a2c
This commit is contained in:
parent
3ce05a8a07
commit
70cd574f67
52
api/@ohos.app.appstartup.StartupConfig.d.ts
vendored
Normal file
52
api/@ohos.app.appstartup.StartupConfig.d.ts
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 StartupListener from './@ohos.app.appstartup.StartupListener';
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @kit AbilityKit
|
||||
*/
|
||||
|
||||
/**
|
||||
* The interface of configuration for running startup tasks.
|
||||
*
|
||||
* @interface StartupConfig
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
export default interface StartupConfig {
|
||||
/**
|
||||
* Indicates timeout for executing all startup tasks. Default value is 10000 milliseconds.
|
||||
*
|
||||
* @type { ?number }
|
||||
* @default 10000
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
timeoutMs?: number;
|
||||
|
||||
/**
|
||||
* Indicates a listener for startup, which will be called when all tasks complete.
|
||||
*
|
||||
* @type { ?StartupListener }
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
startupListener?: StartupListener;
|
||||
}
|
40
api/@ohos.app.appstartup.StartupConfigEntry.d.ts
vendored
Normal file
40
api/@ohos.app.appstartup.StartupConfigEntry.d.ts
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 StartupConfig from './@ohos.app.appstartup.StartupConfig';
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @kit AbilityKit
|
||||
*/
|
||||
|
||||
/**
|
||||
* The configuration entry for running startup tasks.
|
||||
*
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
export default class StartupConfigEntry {
|
||||
/**
|
||||
* Called when startup initialization to configure startup mode.
|
||||
*
|
||||
* @returns { StartupConfig } The developer returns a startup configuration.
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
onConfig?(): StartupConfig;
|
||||
}
|
40
api/@ohos.app.appstartup.StartupListener.d.ts
vendored
Normal file
40
api/@ohos.app.appstartup.StartupListener.d.ts
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @kit AbilityKit
|
||||
*/
|
||||
|
||||
import { BusinessError } from './@ohos.base';
|
||||
|
||||
/**
|
||||
* The listener for running startup tasks, which will be called when all tasks complete.
|
||||
*
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
export default class StartupListener {
|
||||
/**
|
||||
* Called when all startup tasks complete.
|
||||
*
|
||||
* @param { BusinessError<void> } error - Indicates the error during execution.
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
onCompleted?(error: BusinessError<void>): void;
|
||||
}
|
53
api/@ohos.app.appstartup.StartupTask.d.ts
vendored
Normal file
53
api/@ohos.app.appstartup.StartupTask.d.ts
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 AbilityStageContext from './application/AbilityStageContext';
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @kit AbilityKit
|
||||
*/
|
||||
|
||||
/**
|
||||
* The base class of startup task.
|
||||
*
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
export default class StartupTask {
|
||||
/**
|
||||
* Called when specific dependent task complete.
|
||||
*
|
||||
* @param { string } dependency - Indicates name of specific dependent startup task.
|
||||
* @param { ESObject } result - Indicates result of specific dependent startup task.
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
onDependencyCompleted?(dependency: string, result: ESObject): void;
|
||||
|
||||
/**
|
||||
* Initializes current startup task.
|
||||
* A developer could override this function to init current task and return a result for other tasks.
|
||||
*
|
||||
* @param { AbilityStageContext } context - Indicates ability stage context.
|
||||
* @returns { Promise<ESObject> } The result of initialization.
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
init(context: AbilityStageContext): Promise<ESObject>;
|
||||
}
|
96
api/@ohos.app.appstartup.startupManager.d.ts
vendored
Normal file
96
api/@ohos.app.appstartup.startupManager.d.ts
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 StartupConfig from './@ohos.app.appstartup.StartupConfig';
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @kit AbilityKit
|
||||
*/
|
||||
|
||||
/**
|
||||
* Startup task manager.
|
||||
*
|
||||
* @namespace startupManager
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
declare namespace startupManager {
|
||||
/**
|
||||
* Runs startup tasks.
|
||||
*
|
||||
* @param { Array<string> } startupTasks - Indicates all tasks ready to run.
|
||||
* @param { StartupConfig } [config] - Indicates the configuration of startup tasks.
|
||||
* @returns { Promise<void> } The promise returned by the function.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @throws { BusinessError } 28800001 - Startup task or its dependency not found.
|
||||
* @throws { BusinessError } 28800002 - The startup tasks have circular dependencies.
|
||||
* @throws { BusinessError } 28800003 - An error occurred while running the startup tasks.
|
||||
* @throws { BusinessError } 28800004 - Running startup tasks timeout.
|
||||
*
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
function run(startupTasks: Array<string>, config?: StartupConfig): Promise<void>;
|
||||
|
||||
/**
|
||||
* Removes all startup tasks result.
|
||||
*
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
function removeAllStartupTaskResults(): void;
|
||||
|
||||
/**
|
||||
* Obtains specific startup task result.
|
||||
*
|
||||
* @param { string } startupTask - Indicates name of specific startup task.
|
||||
* @returns { Object } The result of specific startup task.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
function getStartupTaskResult(startupTask: string): Object;
|
||||
|
||||
/**
|
||||
* Obtains whether specific startup task has already been initialized.
|
||||
*
|
||||
* @param { string } startupTask - Indicates name of specific startup task.
|
||||
* @returns { boolean } Whether specific startup task has already been initialized.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
function isStartupTaskInitialized(startupTask: string): boolean;
|
||||
|
||||
/**
|
||||
* Removes specific startup task result.
|
||||
*
|
||||
* @param { string } startupTask - Indicates name of specific startup task.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @syscap SystemCapability.Ability.AppStartup
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
*/
|
||||
function removeStartupTaskResult(startupTask: string): void;
|
||||
}
|
||||
|
||||
export default startupManager;
|
Loading…
Reference in New Issue
Block a user