Fixed README.md and method documentation
This commit is contained in:
parent
23194ac67a
commit
219f079a9e
|
@ -16,6 +16,9 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.yaml" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/.dart_tool/" />
|
||||
<ignored path="$PROJECT_DIR$/.idea/" />
|
||||
|
@ -45,18 +48,18 @@
|
|||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="dart" value="1987" />
|
||||
<entry key="dart" value="2026" />
|
||||
<entry key="html" value="464" />
|
||||
<entry key="md" value="264" />
|
||||
<entry key="yaml" value="2" />
|
||||
<entry key="md" value="388" />
|
||||
<entry key="yaml" value="3" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="Dart" value="1987" />
|
||||
<entry key="HTML" value="464" />
|
||||
<entry key="Markdown" value="264" />
|
||||
<entry key="YAML" value="2" />
|
||||
<entry key="Dart" value="2026" />
|
||||
<entry key="HTML" value="466" />
|
||||
<entry key="Markdown" value="386" />
|
||||
<entry key="YAML" value="3" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
|
@ -92,11 +95,11 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="83" selection-start-line="2" selection-start-column="83" selection-end-line="2" selection-end-column="83" />
|
||||
<caret line="2" column="52" selection-start-line="2" selection-start-column="52" selection-end-line="2" selection-end-column="52" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -113,11 +116,11 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/lib/flutter_inappbrowser.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="254">
|
||||
<caret line="1199" column="51" selection-start-line="1199" selection-start-column="28" selection-end-line="1199" selection-end-column="51" />
|
||||
<state relative-caret-position="159">
|
||||
<caret line="1191" column="11" lean-forward="true" selection-start-line="1191" selection-start-column="11" selection-end-line="1191" selection-end-column="11" />
|
||||
<folding>
|
||||
<element signature="e#814#831#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -128,8 +131,8 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-103">
|
||||
<caret line="571" selection-start-line="571" selection-end-line="571" />
|
||||
<state relative-caret-position="230">
|
||||
<caret line="593" selection-start-line="593" selection-end-line="601" selection-end-column="3" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
|
@ -142,8 +145,8 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="442">
|
||||
<caret line="53" column="11" lean-forward="true" selection-start-line="41" selection-start-column="8" selection-end-line="53" selection-end-column="11" />
|
||||
<state relative-caret-position="211">
|
||||
<caret line="40" column="4" selection-start-line="40" selection-start-column="4" selection-end-line="54" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -187,8 +190,8 @@
|
|||
<find>CallBac</find>
|
||||
<find>dart</find>
|
||||
<find>```</find>
|
||||
<find>JavaScriptHandlerCallback</find>
|
||||
<find>addJavaScriptHandler</find>
|
||||
<find>JavaScriptHandlerCallback</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>activity.getPreferences(0)</replace>
|
||||
|
@ -236,7 +239,6 @@
|
|||
<option value="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/example/lib/test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/lib/main.dart" />
|
||||
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
||||
<option value="$PROJECT_DIR$/example/lib/webview_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/example/assets/css/style.css" />
|
||||
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
|
||||
|
@ -244,9 +246,10 @@
|
|||
<option value="$PROJECT_DIR$/example/assets/index.html" />
|
||||
<option value="$PROJECT_DIR$/example/assets/page-2.html" />
|
||||
<option value="$PROJECT_DIR$/example/assets/page-1.html" />
|
||||
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
|
||||
<option value="$PROJECT_DIR$/README.md" />
|
||||
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -465,8 +468,8 @@
|
|||
<frame x="0" y="23" width="1920" height="1057" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.6395349" visible="true" weight="0.18210863" />
|
||||
<window_info id="Structure" order="1" sideWeight="0.3604651" side_tool="true" visible="true" weight="0.18210863" />
|
||||
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.6402778" visible="true" weight="0.18210863" />
|
||||
<window_info id="Structure" order="1" sideWeight="0.35972223" side_tool="true" visible="true" weight="0.18210863" />
|
||||
<window_info id="Designer" order="2" />
|
||||
<window_info id="Build Variants" order="3" side_tool="true" />
|
||||
<window_info id="Captures" order="4" side_tool="true" weight="0.32936507" />
|
||||
|
@ -483,9 +486,9 @@
|
|||
<window_info anchor="bottom" id="Android Profiler" order="7" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Event Log" order="8" sideWeight="0.5052169" side_tool="true" weight="0.34068358" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" />
|
||||
<window_info active="true" anchor="bottom" id="Terminal" order="10" sideWeight="0.49533224" visible="true" weight="0.4522293" />
|
||||
<window_info anchor="bottom" id="Terminal" order="10" sideWeight="0.49533224" weight="0.4522293" />
|
||||
<window_info anchor="bottom" id="Logcat" order="11" />
|
||||
<window_info anchor="bottom" id="Messages" order="12" weight="0.2356688" />
|
||||
<window_info active="true" anchor="bottom" id="Messages" order="12" visible="true" weight="0.2356688" />
|
||||
<window_info anchor="bottom" id="Dependency Viewer" order="13" weight="0.32800853" />
|
||||
<window_info anchor="bottom" id="Dart Analysis" order="14" weight="0.32590234" />
|
||||
<window_info anchor="bottom" id="Flutter Performance" order="15" side_tool="true" />
|
||||
|
@ -750,22 +753,10 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-103">
|
||||
<caret line="571" selection-start-line="571" selection-end-line="571" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="442">
|
||||
<caret line="53" column="11" lean-forward="true" selection-start-line="41" selection-start-column="8" selection-end-line="53" selection-end-column="11" />
|
||||
<state relative-caret-position="211">
|
||||
<caret line="40" column="4" selection-start-line="40" selection-start-column="4" selection-end-line="54" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -776,13 +767,10 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/flutter_inappbrowser.dart">
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="254">
|
||||
<caret line="1199" column="51" selection-start-line="1199" selection-start-column="28" selection-end-line="1199" selection-end-column="51" />
|
||||
<folding>
|
||||
<element signature="e#814#831#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="52" selection-start-line="2" selection-start-column="52" selection-end-line="2" selection-end-column="52" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -796,10 +784,25 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="83" selection-start-line="2" selection-start-column="83" selection-end-line="2" selection-end-column="83" />
|
||||
<state relative-caret-position="230">
|
||||
<caret line="593" selection-start-line="593" selection-end-line="601" selection-end-column="3" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/flutter_inappbrowser.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="159">
|
||||
<caret line="1191" column="11" lean-forward="true" selection-start-line="1191" selection-start-column="11" selection-end-line="1191" selection-end-column="11" />
|
||||
<folding>
|
||||
<element signature="e#814#831#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
## 1.1.1
|
||||
|
||||
- Fixed README.md and `addJavaScriptHandler` method documentation
|
||||
|
||||
## 1.1.0
|
||||
|
||||
- Breaking change for `addJavaScriptHandler` and `removeJavaScriptHandler` methods.
|
||||
|
|
34
README.md
34
README.md
|
@ -575,18 +575,30 @@ that can be used to get the json result returned by `JavaScriptHandlerCallback`.
|
|||
In this case, simply return data that you want to send and it will be automatically json encoded using `jsonEncode` from the `dart:convert` library.
|
||||
|
||||
So, on the JavaScript side, to get data coming from the Dart side, you will use:
|
||||
```javascript
|
||||
window.addEventListener("flutterInAppBrowserPlatformReady", function(event) {
|
||||
window.flutter_inappbrowser.callHandler('handlerFoo').then(function(result) {
|
||||
console.log(result, typeof result);
|
||||
console.log(JSON.stringify(result));
|
||||
```html
|
||||
<script>
|
||||
window.addEventListener("flutterInAppBrowserPlatformReady", function(event) {
|
||||
window.flutter_inappbrowser.callHandler('handlerFoo').then(function(result) {
|
||||
console.log(result, typeof result);
|
||||
console.log(JSON.stringify(result));
|
||||
});
|
||||
|
||||
window.flutter_inappbrowser.callHandler('handlerFooWithArgs', 1, true, ['bar', 5], {foo: 'baz'}).then(function(result) {
|
||||
console.log(result, typeof result);
|
||||
console.log(JSON.stringify(result));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
window.flutter_inappbrowser.callHandler('handlerFooWithArgs', 1, true, ['bar', 5], {foo: 'baz'}).then(function(result) {
|
||||
console.log(result, typeof result);
|
||||
console.log(JSON.stringify(result));
|
||||
});
|
||||
});
|
||||
Instead, on the `onLoadStop` WebView event, you can use `callHandler` directly:
|
||||
```dart
|
||||
// Inject JavaScript that will receive data back from Flutter
|
||||
inAppWebViewController.injectScriptCode("""
|
||||
window.flutter_inappbrowser.callHandler('test', 'Text from Javascript').then(function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
""");
|
||||
```
|
||||
|
||||
```dart
|
||||
|
@ -599,7 +611,7 @@ Removes a JavaScript message handler previously added with the `addJavaScriptHan
|
|||
Returns the value associated with `handlerName` before it was removed.
|
||||
Returns `null` if `handlerName` was not found.
|
||||
```dart
|
||||
inAppWebViewController.removeJavaScriptHandler(String handlerName, int index);
|
||||
inAppWebViewController.removeJavaScriptHandler(String handlerName);
|
||||
```
|
||||
|
||||
#### Future\<Uint8List\> InAppWebViewController.takeScreenshot
|
||||
|
|
|
@ -1177,7 +1177,8 @@ class InAppWebViewController {
|
|||
///In this case, simply return data that you want to send and it will be automatically json encoded using [jsonEncode] from the `dart:convert` library.
|
||||
///
|
||||
///So, on the JavaScript side, to get data coming from the Dart side, you will use:
|
||||
///```javascript
|
||||
///```html
|
||||
///<script>
|
||||
/// window.addEventListener("flutterInAppBrowserPlatformReady", function(event) {
|
||||
/// window.flutter_inappbrowser.callHandler('handlerFoo').then(function(result) {
|
||||
/// console.log(result, typeof result);
|
||||
|
@ -1189,6 +1190,17 @@ class InAppWebViewController {
|
|||
/// console.log(JSON.stringify(result));
|
||||
/// });
|
||||
/// });
|
||||
///</script>
|
||||
///```
|
||||
///
|
||||
///Instead, on the `onLoadStop` WebView event, you can use `callHandler` directly:
|
||||
///```dart
|
||||
/// // Inject JavaScript that will receive data back from Flutter
|
||||
/// inAppWebViewController.injectScriptCode("""
|
||||
/// window.flutter_inappbrowser.callHandler('test', 'Text from Javascript').then(function(result) {
|
||||
/// console.log(result);
|
||||
/// });
|
||||
/// """);
|
||||
///```
|
||||
void addJavaScriptHandler(String handlerName, JavaScriptHandlerCallback callback) {
|
||||
this.javaScriptHandlersMap[handlerName] = (callback);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_inappbrowser
|
||||
description: A Flutter plugin that allows you to add an inline webview or open an in-app browser window (inspired by the popular cordova-plugin-inappbrowser).
|
||||
version: 1.1.0
|
||||
version: 1.1.1
|
||||
author: Lorenzo Pichilli <pichillilorenzo@gmail.com>
|
||||
homepage: https://github.com/pichillilorenzo/flutter_inappbrowser
|
||||
|
||||
|
|
Loading…
Reference in New Issue