diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts index 1bdda2c0e01520379a5bd098897bc52f05c00862..74a71f605c008dc09c503abf2e11acf5b9590e7d 100755 --- a/api/@internal/component/ets/web.d.ts +++ b/api/@internal/component/ets/web.d.ts @@ -133,7 +133,13 @@ declare enum HitTestType { */ declare enum CacheMode { /** - * load online and not cache. + * load cache when they are available and not expired, otherwise load online. + * @since 8 + */ + Default, + + /** + * load cache when they are available, otherwise load online. * @since 8 */ None, @@ -151,6 +157,115 @@ declare enum CacheMode { Only, } +/** + * Enum type supplied to {@link renderExitReason} when onRenderExited being called. + * @since 8 + */ +declare enum RenderExitReason { + /** + * Render process non-zero exit status. + * @since 8 + */ + PROCESS_ABNORMAL_TERMINATION, + + /** + * SIGKILL or task manager kill. + * @since 8 + */ + PROCESS_WAS_KILLED, + + /** + * SIGKILL or task manager kill. + * @since 8 + */ + PROCESS_CRASHED, + + /** + * SIGKILL or task manager kill. + * @since 8 + */ + PROCESS_OOM, + + /** + * SIGKILL or task manager kill. + * @since 8 + */ + PROCESS_EXIT_UNKNOWN, +} + +/** + * Enum type supplied to {@link FileSelectorParam} when onFileSelectorShow being called. + * @since 8 + */ +declare enum FileSelectorMode { + /** + * Allows single file to be selected. + * @since 8 + */ + FILE_OPEN_MODE, + + /** + * Allows multiple files to be selected. + * @since 8 + */ + FILE_OPEN_MULTIPLE_MODE, + + /** + * Allows file folders to be selected. + * @since 8 + */ + FILE_OPEN_FOLDER_MODE, + + /** + * Allows multiple files to be selected. + * @since 8 + */ + FILE_SAVE_MODE, +} + +/** + * Encompassed message information as parameters to {@link onFileSelectorShow} method. + * @since 8 + */ +declare class FileSelectorParam { + /** + * Constructor. + * @since 8 + */ + constructor(); + + /** + * Gets the title of this file selector. + * @return Return the title of this file selector. + * + * @since 8 + */ + title(): string; + + /** + * Gets the FileSelectorMode of this file selector. + * @return Return the FileSelectorMode of this file selector. + * + * @since 8 + */ + mode(): FileSelectorMode; + + /** + * Gets an array of acceptable MMIE type. + * @return Return an array of acceptable MMIE type. + * + * @since 8 + */ + acceptType(): Array; + + /** + * Gets whether this file selector use a live media captured value. + * @return Return {@code true} if captured media; return {@code false} otherwise. + * @since 8 + */ + isCapture(): boolean; +} + /** * Defines the js result. * @since 8 @@ -175,6 +290,24 @@ declare class JsResult { handleConfirm(): void; } +/** + * Defines the file selector result, related to {@link onFileSelectorShow} method. + * @since 8 + */ +declare class FileSelectorResult { + /** + * Constructor. + * @since 8 + */ + constructor(); + + /** + * select a list of files. + * @since 8 + */ + handleFileList(fileList: Array): void; +} + /** * Encompassed message information as parameters to {@link onConsole} method. * @since 8 @@ -224,6 +357,11 @@ declare class ConsoleMessage { getMessageLevel(): MessageLevel; } +/** + * Encompassed message information as parameters to {@link onConsole} method. + * @since 8 + */ + /** * Defines the Web resource request. * @since 8 @@ -340,7 +478,7 @@ declare class WebResourceRequest { * Defines the Web's request/response header. * @since 8 */ - declare interface Header { +declare interface Header { /** * Gets the key of the request/response header. * @since 8 @@ -404,6 +542,8 @@ declare class JsGeolocation { invoke(origin: string, allow: boolean, retain: boolean): void; } + + /** * Defines the Web cookie. * @since 8 @@ -419,13 +559,13 @@ declare class WebCookie { * Sets the cookie. * @since 8 */ - setCookie(); + setCookie(url: string, value: string, callback?: (result: boolean) => void); /** * Saves the cookies. * @since 8 */ - saveCookie(); + saveCookie(callback?: (result: boolean) => void); } /** @@ -560,6 +700,12 @@ declare class WebCookie { * @since 8 */ forward(); + + /** + * Gets network cookie manager + * @since 8 + */ + getCookieManager() : WebCookie } /** @@ -612,6 +758,15 @@ declare class WebAttribute extends CommonMethod { */ fileAccess(fileAccess: boolean): WebAttribute; + /** + * Sets whether javaScript running in the context of a file URL can access content from other file URLs. + * @param fileFromUrlAccess {@code true} means enable a file URL can access other file URLs; + * {@code false} otherwise. + * + * @since 8 + */ + fileFromUrlAccess(fileFromUrlAccess: boolean): WebAttribute; + /** * Sets whether to allow image resources to be loaded from the network. * @param onlineImageAccess {@code true} means the Web can allow image resources to be loaded from the network; @@ -854,7 +1009,7 @@ declare class WebAttribute extends CommonMethod { * * @since 8 */ - onRefreshAccessedHistory(callback: (event?: { url: string, refreshed: boolean }) => void): WebAttribute; + onRefreshAccessedHistory(callback: (event?: { url: string, isRefreshed: boolean }) => void): WebAttribute; /** * Triggered when the URL loading is intercepted. @@ -878,7 +1033,7 @@ declare class WebAttribute extends CommonMethod { * * @since 8 */ - onRenderExited(callback: (event?: { detail: object }) => boolean): WebAttribute; + onRenderExited(callback: (event?: { renderExitReason: RenderExitReason }) => void): WebAttribute; /** * Triggered when the file selector shows. @@ -886,7 +1041,8 @@ declare class WebAttribute extends CommonMethod { * * @since 8 */ - onFileSelectorShow(callback: (event?: { callback: Function, fileSelector: object }) => void): WebAttribute; + onFileSelectorShow(callback: (event?: { result: FileSelectorResult, + fileSelector: FileSelectorParam }) => void): WebAttribute; } declare const Web: WebInterface;