pauseTimers method

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebView.pauseTimers', apiUrl: 'https://developer.android.com/reference/android/webkit/WebView#pauseTimers()'), IOSPlatform(note: 'This method is implemented using JavaScript and it is restricted to just this WebView.'), MacOSPlatform(note: 'This method is implemented using JavaScript and it is restricted to just this WebView.')])
Future<void> pauseTimers()

On Android native WebView, it pauses all layout, parsing, and JavaScript timers for all WebViews. This is a global requests, not restricted to just this WebView. This can be useful if the application has been paused.

Officially Supported Platforms/Implementations:

  • Android WebView (Official API - WebView.pauseTimers)
  • iOS WKWebView:
    • This method is implemented using JavaScript and it is restricted to just this WebView.
  • macOS WKWebView:
    • This method is implemented using JavaScript and it is restricted to just this WebView.

Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'WebView.pauseTimers',
      apiUrl:
          'https://developer.android.com/reference/android/webkit/WebView#pauseTimers()',
    ),
    IOSPlatform(
      note:
          'This method is implemented using JavaScript and it is restricted to just this WebView.',
    ),
    MacOSPlatform(
      note:
          'This method is implemented using JavaScript and it is restricted to just this WebView.',
    ),
  ],
)
Future<void> pauseTimers() {
  throw UnimplementedError(
    '${PlatformInAppWebViewControllerMethod.pauseTimers.name} is not implemented on the current platform',
  );
}