diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 868d38934dcaecbf529b13934f6d49f7003b2166..69c33f7bf3bda1bf22aea6a8deabeccf57431315 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -14,11 +14,11 @@ */ import { AsyncCallback, Callback } from './basic' ; import { Context } from './app/context'; -import { ContenStorage } from './@internal/component/ets/stateManagement' +import { ContentStorage } from './@internal/component/ets/stateManagement' /** * Window manager. * @syscap SystemCapability.WindowManager.WindowManager.Core -*/ + */ declare namespace window { /** * The type of a window. @@ -64,89 +64,6 @@ declare namespace window { FLOATING } - /** - * Create a sub window with a specific id and type, only support 7. - * @param id Indicates window id. - * @param type Indicates window type. - * @since 7 - */ - function create(id: string, type: WindowType, callback: AsyncCallback): void; - - /** - * Create a sub window with a specific id and type, only support 7. - * @param id Indicates window id. - * @param type Indicates window type. - * @since 7 - */ - function create(id: string, type: WindowType): Promise; - - /** - * Create a system window with a specific id and type. - * @param ctx Indicates the context on which the window depends - * @param id Indicates window id. - * @param type Indicates window type. - * @systemapi Hide this for inner system use. - * @since 8 - */ - function create(ctx: Context, id: string, type: WindowType): Promise; - - /** - * Find the window by id. - * @param id Indicates window id. - * @since 7 - */ - function find(id: string, callback: AsyncCallback): void; - - /** - * Find the window by id. - * @param id Indicates window id. - * @since 7 - */ - function find(id: string): Promise; - - /** - * Get the final show window. - * @param id Indicates window id. - * @since 6 - */ - function getTopWindow(callback: AsyncCallback): void; - - /** - * Get the final show window. - * @since 6 - */ - function getTopWindow(): Promise; - - /** - * Get the final show window. - * @param ctx Indicates the context on which the window depends - * @since 8 - */ - function getTopWindow(ctx: Context): Promise; - - /** - * Get the final show window. - * @param ctx Indicates the context on which the window depends - * @since 8 - */ - function getTopWindow(ctx: Context, callback: AsyncCallback): void; - - /** - * register the callback of systemBarTintChange - * @param type: 'systemBarTintChange' - * @systemapi Hide this for inner system use. - * @since 8 - */ - function on(type: 'systemBarTintChange', callback: Callback): void; - - /** - * unregister the callback of systemBarTintChange - * @param type: 'systemBarTintChange' - * @systemapi Hide this for inner system use. - * @since 8 - */ - function off(type: 'systemBarTintChange', callback?: Callback): void; - /** * Properties of status bar and navigation bar, it couldn't update automatically * @syscap SystemCapability.WindowManager.WindowManager.Core @@ -325,7 +242,7 @@ declare namespace window { /** * Whether the window layout is in full screen mode(whether the window is immersive). The default value is false. - * @since 6 + * @since 7 */ isLayoutFullScreen: boolean @@ -337,7 +254,7 @@ declare namespace window { /** * Whether the window is touchable. The default value is false - * @since 6 + * @since 7 */ touchable: boolean } @@ -357,41 +274,136 @@ declare namespace window { WIDE_GAMUT, } + /** + * Create a sub window with a specific id and type, only support 7. + * @param id Indicates window id. + * @param type Indicates window type. + * @since 7 + */ + function create(id: string, type: WindowType, callback: AsyncCallback): void; + + /** + * Create a sub window with a specific id and type, only support 7. + * @param id Indicates window id. + * @param type Indicates window type. + * @since 7 + */ + function create(id: string, type: WindowType): Promise; + + /** + * Create a system or float window with a specific id and type. + * @param ctx Indicates the context on which the window depends + * @param id Indicates window id. + * @param type Indicates window type. + * @systemapi Hide this for inner system use. + * @permission ohos.permission.SYSTEM_FLOAT_WINDOW + * @since 8 + */ + function create(ctx: Context, id: string, type: WindowType): Promise; + + /** + * Create a system or float window with a specific id and type. + * @param ctx Indicates the context on which the window depends + * @param id Indicates window id. + * @param type Indicates window type. + * @systemapi Hide this for inner system use. + * @permission ohos.permission.SYSTEM_FLOAT_WINDOW + * @since 8 + */ + function create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback): void; + + /** + * Find the window by id. + * @param id Indicates window id. + * @since 7 + */ + function find(id: string, callback: AsyncCallback): void; + + /** + * Find the window by id. + * @param id Indicates window id. + * @since 7 + */ + function find(id: string): Promise; + + /** + * Get the final show window. + * @param id Indicates window id. + * @since 6 + */ + function getTopWindow(callback: AsyncCallback): void; + + /** + * Get the final show window. + * @since 6 + */ + function getTopWindow(): Promise; + + /** + * Get the final show window. + * @param ctx Indicates the context on which the window depends + * @since 8 + */ + function getTopWindow(ctx: Context): Promise; + + /** + * Get the final show window. + * @param ctx Indicates the context on which the window depends + * @since 8 + */ + function getTopWindow(ctx: Context, callback: AsyncCallback): void; + + /** + * register the callback of systemBarTintChange + * @param type: 'systemBarTintChange' + * @systemapi Hide this for inner system use. + * @since 8 + */ + function on(type: 'systemBarTintChange', callback: Callback): void; + + /** + * unregister the callback of systemBarTintChange + * @param type: 'systemBarTintChange' + * @systemapi Hide this for inner system use. + * @since 8 + */ + function off(type: 'systemBarTintChange', callback?: Callback): void; + interface Window { /** - * hide sub window. + * hide window. * @systemapi Hide this for inner system use. * @since 7 */ hide (callback: AsyncCallback): void; /** - * hide sub window. + * hide window. * @systemapi Hide this for inner system use. * @since 7 */ hide(): Promise; /** - * show sub window. + * show window. * @since 7 */ show(callback: AsyncCallback): void; /** - * show sub window. + * show window. * @since 7 */ show(): Promise; /** - * Destroy the sub window. + * Destroy the window. * @since 7 */ destroy(callback: AsyncCallback): void; /** - * Destroy the sub window. + * Destroy the window. * @since 7 */ destroy(): Promise; @@ -549,23 +561,24 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 8 */ - loadContent(path: string, storage: ContenStorage, callback: AsyncCallback): void; + loadContent(path: string, storage: ContentStorage, callback: AsyncCallback): void; /** * Loads content * @param path path of the page to which the content will be loaded + * @param storage storage The data object shared within the content instance loaded by the window * @syscap SystemCapability.WindowManager.WindowManager.Core - * @since 7 + * @since 9 */ - loadContent(path: string, callback: AsyncCallback): void; + loadContent(path: string, storage?: ContentStorage): Promise; /** * Loads content - * @param path path of the page to which the content will be loaded + * @param path path of the page to which the content will be loaded2 * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 */ - loadContent(path: string, storage?: ContenStorage): Promise; + loadContent(path: string, callback: AsyncCallback): void; /** * Checks whether the window is displayed @@ -651,7 +664,11 @@ declare namespace window { */ getColorSpace(callback: AsyncCallback): void; } - + /** + * window stage callback event type + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ enum WindowStageEventType { FOREGROUND = 1, ACTIVE, @@ -661,6 +678,7 @@ declare namespace window { /** * WindowStage * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 */ interface WindowStage { /** @@ -702,21 +720,22 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ - loadContent(path: string, storage: ContenStorage, callback: AsyncCallback): void; + loadContent(path: string, storage: ContentStorage, callback: AsyncCallback): void; /** * Loads content * @param path path of the page to which the content will be loaded + * @param storage storage The data object shared within the content instance loaded by the window * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ - loadContent(path: string, callback: AsyncCallback): void; + loadContent(path: string, storage?: ContentStorage): Promise; /** * Loads content * @param path path of the page to which the content will be loaded * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ - loadContent(path: string, storage?: ContenStorage): Promise; + loadContent(path: string, callback: AsyncCallback): void; /** * window stage event callback on. * @since 9