forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[webview_flutter_platform_interface] Adds option to override console …
…log (flutter#4701) Adds an option to the `webview_flutter_platform_interface` to register a JavaScript console callback. This will allow developers to receive JavaScript console messages in a Dart callback. This PR contains the `webview_flutter_platform_interface` changes from PR flutter#4541. Related issue: flutter#32908 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
- Loading branch information
1 parent
b8b84b2
commit 1598ccd
Showing
9 changed files
with
84 additions
and
3 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
..._flutter/webview_flutter_platform_interface/lib/src/types/javascript_console_message.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:meta/meta.dart'; | ||
|
||
import 'javascript_log_level.dart'; | ||
|
||
/// Represents a console message written to the JavaScript console. | ||
@immutable | ||
class JavaScriptConsoleMessage { | ||
/// Creates a [JavaScriptConsoleMessage]. | ||
const JavaScriptConsoleMessage({ | ||
required this.level, | ||
required this.message, | ||
}); | ||
|
||
/// The severity of a JavaScript log message. | ||
final JavaScriptLogLevel level; | ||
|
||
/// The message written to the console. | ||
final String message; | ||
} |
24 changes: 24 additions & 0 deletions
24
...ebview_flutter/webview_flutter_platform_interface/lib/src/types/javascript_log_level.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
/// Represents the severity of a JavaScript log message. | ||
enum JavaScriptLogLevel { | ||
/// Indicates an error message was logged via an "error" event of the | ||
/// `console.error` method. | ||
error, | ||
|
||
/// Indicates a warning message was logged using the `console.warning` | ||
/// method. | ||
warning, | ||
|
||
/// Indicates a debug message was logged using the `console.debug` method. | ||
debug, | ||
|
||
/// Indicates an informational message was logged using the `console.info` | ||
/// method. | ||
info, | ||
|
||
/// Indicates a log message was logged using the `console.log` method. | ||
log, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...utter/webview_flutter_platform_interface/test/platform_webview_controller_test.mocks.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
.../webview_flutter/webview_flutter_platform_interface/test/webview_platform_test.mocks.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters