### Set Auto Start Picture-in-Picture Source: https://github.com/openharmony/interface_sdk-js/blob/master/build-tools/api_check_plugin/config/errorMaskWhiteList.txt Enables auto start picture-in-picture when back home. ```javascript /** Set if auto start picture-in-picture when back home * @param { boolean } enable - Enable auto start picture-in-picture when back home * @since 11 */ setAutoStartPictureEnabled(enable: boolean): void; ``` -------------------------------- ### Error Mask Configuration Example Source: https://github.com/openharmony/interface_sdk-js/blob/master/build-tools/api_check_plugin/config/errorMaskWhiteList.txt Example of an error mask configuration entry, specifying the source file, kind of error, name, and a descriptive message. ```json { "fileName": "api\/ohos.PiPWINDOW.d.ts", "kind": "ModuleDeclaration", "name": "PiPWINDOW", "hierarchicalRelationship": ["ModuleDeclaration", "SourceFile"], "text": "module'ExpectedFrameRateRange'// @ts-ignoreexporttype{ExpectedFrameRateRange}; ", "errorMessage": "API check error of [naming errors]: This name [ExpectedFrameRateRange] should be named by small hump." } ``` -------------------------------- ### console.time() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Starts a timer. ```typescript static time(label?: string): void ``` -------------------------------- ### System Capability Check Source: https://github.com/openharmony/interface_sdk-js/blob/master/api/@internal/ets/CLAUDE.md Provides an example of checking for the availability of a specific system capability. ```typescript if (canIUse("SystemCapability.ArkUI.ArkUI.Full")) { // Use the capability } ``` -------------------------------- ### Update Content Size Source: https://github.com/openharmony/interface_sdk-js/blob/master/build-tools/api_check_plugin/config/errorMaskWhiteList.txt Update source content size to adjust PiP window aspect ratio. ```javascript /** Update source content size to adjust PiP window aspect ratio. * @param { number } width - Indicates the width of the content. * @param { number } height - Indicates the height of the content. * @throws { BusinessError } 401 - Params error, invalid width or height. * @syscap SystemCapability.Window.SessionManager * @since 11 */ updateContentSize(width: number, height: number): void; ``` -------------------------------- ### Register Picture-in-Picture Control Listener Source: https://github.com/openharmony/interface_sdk-js/blob/master/build-tools/api_check_plugin/config/errorMaskWhiteList.txt Register picture-in-picture control event listener. ```javascript /** Register picture-in-picture control event listener. * @param {'stateChange'} type - Registration type, PiP lifecycle */ registerPictureInPictureListener(type: 'stateChange') ``` -------------------------------- ### PiPWINDOW Module Declaration Source: https://github.com/openharmony/interface_sdk-js/blob/master/build-tools/api_check_plugin/config/errorMaskWhiteList.txt Declaration for the PiPWINDOW namespace, including JSDoc comments for functionality and parameters. ```typescript /** * If picture-in-picture enabled in current OS. * @returns {boolean} true if PictureInPicture enabled, otherwise false * @syscap SystemCapability.Window.SessionManager * @since 11 */ function isPiPEnabled(): boolean; /** * Create picture-in-picture controller * @param {PiPConfiguration} config - Pa ``` -------------------------------- ### State Change Event Listener Source: https://github.com/openharmony/interface_sdk-js/blob/master/build-tools/api_check_plugin/config/errorMaskWhiteList.txt Callback for handling state change events. Used to register listeners for 'stateChange' commands. ```typescript on({ type: 'stateChange', callback: (state: PiPSState, reason: string) => void }): void; /* * Unregister picture-in-picture life-cycle event listener. * @param type - Registration type, 'stateChange' * @param callback - Used to handle 'stateChange' command * @syscap SystemCapability.Window.SessionManager * @since 11 */ off({ type: 'stateChange' }): void; /* * Register picture-in-picture control event listener. * @param type - Registration type, user action event, 'controlPanelActionEvent' * @param callback - Used to handle 'controlPanelActionEvent' command * @syscap SystemCapability.Window.SessionManager * @since 11 */ ``` -------------------------------- ### console.log() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Outputs normal logs. ```typescript static log(message: string, ...arguments: any[]): void ``` -------------------------------- ### console.dir() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Prints the properties of a JavaScript object. ```typescript static dir(dir?: Object): void ``` -------------------------------- ### console.dirxml() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Displays an interactive tree with the descendants of the XML element specified. ```typescript static dirxml(...arguments: Object[]): void ``` -------------------------------- ### Error Mask Whitelist Configuration Source: https://github.com/openharmony/interface_sdk-js/blob/master/build-tools/api_check_plugin/config/errorMaskWhiteList.txt This section defines specific error codes and their corresponding descriptions, used for masking or handling errors related to the PiP (Picture-in-Picture) window functionality. It includes error codes for abnormal PiP window states, creation failures, content loading issues, and stopping the PiP window. ```plaintext 6e * @throws { BusinessError } 1300012 - If PiP window state is abnormal. * @throws { BusinessError } 1300013 - Create PiP window failed. * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window * @throws { BusinessError } 1300015 - If window has created * @syscap SystemCapability.Window.WindowManager * @since 11 */ startPiP(): Promise; /** * * Stop picture-in-picture. * * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 1300011 - Stop PiP window failed. * @throws { BusinessError } 1300012 - If PiP window state is abnormal. * @throws { BusinessError } 1300015 - If window is stopping * @syscap SystemCapability.Window.WindowManager * @since 11 */ stopPiP(): Promise; ``` -------------------------------- ### console.table() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Prints data in a table format. ```typescript static table(tableData?: Object): void ``` -------------------------------- ### console.info() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Outputs information logs, an alias for console.log(). ```typescript static info(message: string, ...arguments: any[]): void ``` -------------------------------- ### console.warn() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Outputs warning logs. ```typescript static warn(message: string, ...arguments: any[]): void ``` -------------------------------- ### Directory Structure Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Illustrates the directory structure for ETS global public APIs. ```plaintext api/@internal/ets/ ├── global.d.ts # Global APIs (console, timer, inspector, etc.) ├── lifecycle.d.ts # Lifecycle interfaces (Form, App, Service, Data) ├── index.d.ts # Main entry file └── CLAUDE.md # Quick Start Guide (English) ``` -------------------------------- ### console.trace() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Prints the stack trace for the current code location. ```typescript static trace(...arguments: Object[]): void ``` -------------------------------- ### Timer Operations Source: https://github.com/openharmony/interface_sdk-js/blob/master/api/@internal/ets/CLAUDE.md Illustrates how to use setTimeout, clearTimeout, setInterval, and clearInterval for managing timed operations. ```typescript // One-time execution const timerId = setTimeout(() => { console.log("Delayed execution"); }, 1000); clearTimeout(timerId); // Repeated execution const intervalId = setInterval(() => { console.log("Repeated execution"); }, 1000); clearInterval(intervalId); ``` -------------------------------- ### console.timeLog() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Prints the elapsed time and other data for a timer. ```typescript static timeLog(label?: string, ...arguments: Object[]): void ``` -------------------------------- ### Console output Source: https://github.com/openharmony/interface_sdk-js/blob/master/api/@internal/ets/CLAUDE.md Demonstrates various console logging and debugging methods available in ETS. ```typescript // Console output console.debug("Debug message"); console.log("Log message"); console.info("Info message"); console.warn("Warning message"); console.error("Error message"); // Advanced console features console.assert(condition, "Assertion failed"); console.count("label"); console.dir(object); console.trace(); ``` -------------------------------- ### Component Inspection (Testing) Source: https://github.com/openharmony/interface_sdk-js/blob/master/api/@internal/ets/CLAUDE.md Shows how to inspect component attributes by ID, retrieve the component tree, and send events to components. ```typescript // Get component attributes by ID const attributes = getInspectorByKey("componentId"); // Get entire component tree const tree = getInspectorTree(); // Send events to components sendEventByKey("buttonId", 10, ""); // Click event ``` -------------------------------- ### console.debug() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Outputs debug-level logs. ```typescript static debug(message: string, ...arguments: any[]): void ``` -------------------------------- ### API Declaration Pattern Source: https://github.com/openharmony/interface_sdk-js/blob/master/api/@internal/ets/CLAUDE.md Illustrates the standard pattern for declaring ETS APIs, including JSDoc comments and version tags. ```typescript /** * Brief description of the API. * * @param { Type } paramName - Description of parameter. * @returns { Type } Description of return value. * @throws { BusinessError } 401 - Error condition. * @syscap SystemCapability.Xxx.Yyy * @crossplatform * @since 10 */ export declare function apiName(paramName: Type): Type; ``` -------------------------------- ### console.error() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Outputs error logs. ```typescript static error(message: string, ...arguments: any[]): void ``` -------------------------------- ### console.count() Source: https://github.com/openharmony/interface_sdk-js/blob/master/docs/api/ets/ETS_Internal_API_Knowledge_Base_CN.md Maintains an internal counter and prints the number of times it has been called. ```typescript static count(label?: string): void ```