diff --git a/README_zh.md b/README_zh.md index 5ce254cc1a173a242aa7ad990efeb21315840a26..dc8cab40ce9a97d36d8bd431487e222d9d92a450 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1,55 +1,70 @@ -# API声明文件公共仓 + + /** + * Register picture-in-picture active status change listener. + * + * @param { 'activeStatusChange' } type - Registration type, active status change, 'activeStatusChange' + * @param { Callback } callback - Used to handle {'activeStatusChange'} command. + * @throws { BusinessError } 801 - Capability not supported. + * function off('pipActiveStatusChange', callback) can not work correctly due to limited device capabilities. + * @throws { BusinessError } 1300014 - PiP internal error. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 dynamic + */ + on(type: 'activeStatusChange', callback: Callback): void; -## 简介 -JS/TS API 公共仓,用来提交 API d.ts 声明文件以及API相关工具。 -## 目录 + /** + * Register picture-in-picture active status change listener. + * + * @param { 'activeStatusChange' } type - Registration type, active status change, 'activeStatusChange' + * @param { Callback } callback - Used to handle {'activeStatusChange'} command. + * @throws { BusinessError } 801 - Capability not supported. + * function off('pipActiveStatusChange', callback) can not work correctly due to limited device capabilities. + * @throws { BusinessError } 1300014 - PiP internal error. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 dynamic + */ + on(type: 'activeStatusChange', callback: Callback): void; -```| -├─api -| ├─@internal -│ | ├─component -│ | | └─ets #基于TS扩展的声明式开发范式组件声明文件 -| | └─ets -| ├─config #基于JS扩展的类Web范式 -| ├─form #JS服务卡片 -| ├─@ohos.×××.d.ts #API声明文件 -| └─@system.×××.d.ts #标记为停止维护的接口 -├─build-tools - ├─api_check_plugin #检查API规范的工具 - | ├─config - | ├─plugin - | ├─src - | └─test - └─cllect_application_api #解析应用到的API的工具(旧) - | ├─deps - | └─src - └─api_collector #解析应用到的API的工具的工具(新) - | ├─scripts - | ├─src - | └─test - └─api_diff #比较两个版本sdk差异的工具(旧) - | ├─src - | └─version_diff_collection - └─collect_api #解析d.ts文件接口的基本信息的工具 - | └─collect_base_api.js - └─diff_api #比较两个版本sdk差异工具(新) - | └─src - └─dts_parser #解析d.ts文件的工具 - | ├─src - | └─test - └─jsdoc_format_plugin #检查并修复jsdoc规范错误的工具 - | ├─loader - | ├─src - | └─test - └─permissions_converter #从config文件提取权限信息,为DevEco Studio提供权限的联想和校验 - | └─convert.js - └─sdk_upgrade_assistance_plugin #SDK升级辅助工具,帮助开发者快速解决SDK升级导致的API不兼容问题 - | └─src -``` - -## 相关仓 - -[interface-sdk_js](https://gitee.com/openharmony/interface_sdk-js/tree/master) + /** + * Register picture-in-picture active status change listener. + * + * @param { 'activeStatusChange' } type - Registration type, active status change, 'activeStatusChange' + * @param { Callback } callback - Used to handle {'activeStatusChange'} command. + * @throws { BusinessError } 801 - Capability not supported. + * function off('pipActiveStatusChange', callback) can not work correctly due to limited device capabilities. + * @throws { BusinessError } 1300014 - PiP internal error. + * @syscap SystemCapability.Window.SessionManager + * @since 22 static + */ + onActiveStatusChange(calback: Callback): void; + /** + * Unregister picture-in-picture active status change listener + * @param { 'activeStatusChange' } type - Registration type, active status change, 'activeStatusChange' + * @param { Callback } callback - Used to handle {'activeStatusChange'} command. If not provided, + * all callbacks for the given event type will be removed. + * @throws { BusinessError } 801 - Capability not supported. + * function off('pipActiveStatusChange', callback) can not work correctly due to limited device capabilities. + * @throws { BusinessError } 1300014 - PiP internal error. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 dynamic + */ + off(type: 'controlEvent', callback?: Callback): void; + + /** + * Unregister picture-in-picture active status change listener + * @param { 'activeStatusChange' } type - Registration type, active status change, 'activeStatusChange' + * @param { Callback } callback - Used to handle {'activeStatusChange'} command. If not provided, + * all callbacks for the given event type will be removed. + * @throws { BusinessError } 801 - Capability not supported. + * function off('pipActiveStatusChange', callback) can not work correctly due to limited device capabilities. + * @throws { BusinessError } 1300014 - PiP internal error. + * @syscap SystemCapability.Window.SessionManager + * @since 22 static + */ + offActiveStatusChange(callback?: Callback): void; \ No newline at end of file diff --git a/api/@ohos.PiPWindow.d.ts b/api/@ohos.PiPWindow.d.ts index 7ed8033f3377114695523a55dce5ae7c0dd1c5b0..b83a0bfd0f389612db70869586e0995f30a67e47 100644 --- a/api/@ohos.PiPWindow.d.ts +++ b/api/@ohos.PiPWindow.d.ts @@ -173,6 +173,17 @@ declare namespace PiPWindow { */ navigationId?: string; + /** + * Indicates the page ID. + * + * @type { ?number } The page ID to which the PiP needs to restore. + * @default -1 + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 + */ + handleId?: number; + /** * Picture-in-picture template type. * @@ -266,6 +277,17 @@ declare namespace PiPWindow { defaultWindowSizeType?: number; } + /** + * Describe picture-in-picture state change reason. + * + * @typedef { 'panelActionDelete' | 'panelActionRestore' | 'dradDelete' | 'requestDelete' | 'requestStart' | 'autoStart' | 'other' } + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 + */ + type PiPStateChangeReason = 'panelActionDelete' | 'panelActionRestore' | 'dradDelete' | 'requestDelete' | 'requestStart' | 'autoStart' | 'other'; + + /** * The picture-in-picture window size * @@ -1110,7 +1132,7 @@ declare namespace PiPWindow { * @atomicservice * @since 12 */ - on(type: 'stateChange', callback: (state: PiPState, reason: string) => void): void; + on(type: 'stateChange', callback: (state: PiPState, reason: string, reasonType?: PiPStateChangeReason) => void): void; /** * Unregister picture-in-picture lifecycle event listener.