diff --git a/api/@ohos.web.webview.d.ts b/api/@ohos.web.webview.d.ts index 92af77f3b9b97c35db4c833c9368a2d811fd6750..d4f7bcbd6f8da476d96509d80d481cff65e98c82 100644 --- a/api/@ohos.web.webview.d.ts +++ b/api/@ohos.web.webview.d.ts @@ -5409,8 +5409,7 @@ declare namespace webview { * The WebviewController must be associated with a Web component. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ hasImage(): Promise; @@ -5434,11 +5433,43 @@ declare namespace webview { * The WebviewController must be associated with a Web component. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ hasImage(callback: AsyncCallback): void; + /** + * Asynchronous search for image existence on the current page through Promise method. + * + * @returns { Promise } A promise resolved after query image has finished. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + hasImageWithPromise(): Promise; + + /** + * Asynchronous search for the presence of an image on the current page through callback method. + * + * @param { AsyncCallback } callback - Called after query image has finished. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + hasImageWithCallback(callback: AsyncCallback): void; + + /** + * @arkts 1.2 + */ + overload hasImage{hasImageWithPromise,hasImageWithCallback}; + /** * Get back forward stack list from current webview. * @returns { BackForwardList } Back forward list for current webview. @@ -8711,10 +8742,20 @@ declare namespace webview { * @param { PlaybackStatus } status - Playback status of native media player. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + handleStatusChanged(status: PlaybackStatus): void; + + /** + * Handle native media player playback status. + * + * @type { ?OneParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 */ - handleStatusChanged(status: PlaybackStatus): void + handleStatusChanged?: OneParamFn; /** * Handle native media player volume. @@ -8724,10 +8765,22 @@ declare namespace webview { * @param { double } volume - Current volume of native media player. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - handleVolumeChanged(volume: double): void + handleVolumeChanged(volume: double): void; + + /** + * Handle native media player volume. + * volume: float + * value range: [0 - 1.0] + * + * @type { ?OneParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + handleVolumeChanged?: OneParamFn; /** * Handle native media player muted status. @@ -8735,10 +8788,20 @@ declare namespace webview { * @param { boolean } muted - Current mute status of native media player. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - handleMutedChanged(muted: boolean): void + handleMutedChanged(muted: boolean): void; + + /** + * Handle native media player muted status. + * + * @type { ?OneParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + handleMutedChanged?: OneParamFn; /** * Handle playback rate of native media player. @@ -8748,10 +8811,22 @@ declare namespace webview { * @param { double } playbackRate - Current playback rate of native media player. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + handlePlaybackRateChanged(playbackRate: double): void; + + /** + * Handle playback rate of native media player. + * playbackRate: float + * value range: [0 - infinity] + * + * @type { ?OneParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 */ - handlePlaybackRateChanged(playbackRate: double): void + handlePlaybackRateChanged?: OneParamFn; /** * Handle duration time of media. @@ -8761,10 +8836,22 @@ declare namespace webview { * @param { double } duration - Duration time (in seconds) of media. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + handleDurationChanged(duration: double): void; + + /** + * Handle duration time of media. + * duration: float + * value range: [0 - infinity] + * + * @type { ?OneParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 */ - handleDurationChanged(duration: double): void + handleDurationChanged?: OneParamFn; /** * Handle current playing time of media. @@ -8774,10 +8861,22 @@ declare namespace webview { * @param { double } currentPlayTime - Current playing time (in seconds) of media. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + handleTimeUpdate(currentPlayTime: double): void; + + /** + * Handle current playing time of media. + * currentPlayTime: float + * value range: [0 - duration] + * + * @type { ?OneParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 */ - handleTimeUpdate(currentPlayTime: double): void + handleTimeUpdate?: OneParamFn; /** * Handle buffered end time of media. @@ -8787,20 +8886,42 @@ declare namespace webview { * @param { double } bufferedEndTime - Buffered end time (in seconds) of media. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - handleBufferedEndTimeChanged(bufferedEndTime: double): void + handleBufferedEndTimeChanged(bufferedEndTime: double): void; + + /** + * Handle buffered end time of media. + * bufferedEndTime: float + * value range: [0 - duration] + * + * @type { ?OneParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + handleBufferedEndTimeChanged?: OneParamFn; /** * Handle native player ended event. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + handleEnded(): void; + + /** + * Handle native player ended event. + * + * @type { ?ZeroParamFn<> } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 */ - handleEnded(): void + handleEnded?: ZeroParamFn<>; /** * Handle network state of native media player. @@ -8808,10 +8929,20 @@ declare namespace webview { * @param { NetworkState } state - Network state of native media player. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + handleNetworkStateChanged(state: NetworkState): void; + + /** + * Handle network state of native media player. + * + * @type { ?OneParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 */ - handleNetworkStateChanged(state: NetworkState): void + handleNetworkStateChanged?: OneParamFn; /** * Handle ready state of native media player. @@ -8819,10 +8950,20 @@ declare namespace webview { * @param { ReadyState } state - Ready state of native media player. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - handleReadyStateChanged(state: ReadyState): void + handleReadyStateChanged(state: ReadyState): void; + + /** + * Handle ready state of native media player. + * + * @type { ?OneParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + handleReadyStateChanged?: OneParamFn; /** * Handle native media player fullscreen state changed event. @@ -8830,30 +8971,60 @@ declare namespace webview { * @param { boolean } fullscreen - Fullscreen state of native media player. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - handleFullscreenChanged(fullscreen: boolean): void + handleFullscreenChanged(fullscreen: boolean): void; + + /** + * Handle native media player fullscreen state changed event. + * + * @type { ?OneParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + handleFullscreenChanged?: OneParamFn; /** * Handle native media player seeking state. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + handleSeeking(): void; + + /** + * Handle native media player seeking state. + * + * @type { ?ZeroParamFn<> } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 */ - handleSeeking(): void + handleSeeking?: ZeroParamFn<>; /** * Handle native media player seek finished state. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + handleSeekFinished(): void; + + /** + * Handle native media player seek finished state. + * + * @type { ?ZeroParamFn<> } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 */ - handleSeekFinished(): void + handleSeekFinished?: ZeroParamFn<>; /** * Handle native media player error event. @@ -8862,10 +9033,20 @@ declare namespace webview { * @param { string } errorMessage - Description of current error. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + handleError(error: MediaError, errorMessage: string): void; + + /** + * Handle native media player error event. + * + * @type { ?TwoParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 */ - handleError(error: MediaError, errorMessage: string): void + handleError?: TwoParamFn; /** * Handle size of video. @@ -8874,10 +9055,20 @@ declare namespace webview { * @param { double } height - Height of video. * @syscap SystemCapability.Web.Webview.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - handleVideoSizeChanged(width: double, height: double): void + handleVideoSizeChanged(width: double, height: double): void; + + /** + * Handle size of video. + * + * @type { ?TwoParamFn } + * @syscap SystemCapability.Web.Webview.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + handleVideoSizeChanged?: TwoParamFn; } /** @@ -10099,6 +10290,41 @@ declare namespace webview { static removeProxyOverride(callback: OnProxyConfigChangeCallback): void; } + /** + * The function with zero parameter. + * + * @typedef { function } zeroParamFn + * @returns { V } The return value. + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.2 + */ + type ZeroParamFn = () => V; + + /** + * The function with one parameter. + * + * @typedef { function } oneParamFn + * @param { T } param - the first param. + * @returns { V } The return value. + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.2 + */ + type OneParamFn = (param: T) => V; + + /** + * The function with two parameter. + * + * @typedef { function } twoParamFn + * @param { T } paramA - the first param. + * @param { C } paramB - the second param. + * @returns { V } The return value. + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.2 + */ + type TwoParamFn = (paramA: T,paramB: C) => V; } export default webview;