diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 8ff85f57..48b812ad 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -16,6 +16,9 @@
+
+
+
@@ -45,18 +48,18 @@
-
+
-
-
+
+
-
-
-
-
+
+
+
+
@@ -92,11 +95,11 @@
-
+
-
+
@@ -113,11 +116,11 @@
-
+
-
-
+
+
@@ -128,8 +131,8 @@
-
-
+
+
@@ -142,8 +145,8 @@
-
-
+
+
@@ -187,8 +190,8 @@
CallBac
dart
```
- JavaScriptHandlerCallback
addJavaScriptHandler
+ JavaScriptHandlerCallback
activity.getPreferences(0)
@@ -236,7 +239,6 @@
-
@@ -244,9 +246,10 @@
-
+
+
@@ -465,8 +468,8 @@
-
-
+
+
@@ -483,9 +486,9 @@
-
+
-
+
@@ -750,22 +753,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -776,13 +767,10 @@
-
+
-
-
-
-
-
+
+
@@ -796,10 +784,25 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 360dd0b6..ae69dce4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.1.1
+
+- Fixed README.md and `addJavaScriptHandler` method documentation
+
## 1.1.0
- Breaking change for `addJavaScriptHandler` and `removeJavaScriptHandler` methods.
diff --git a/README.md b/README.md
index 3d9e044c..97416630 100644
--- a/README.md
+++ b/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
+
+```
- 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\ InAppWebViewController.takeScreenshot
diff --git a/lib/flutter_inappbrowser.dart b/lib/flutter_inappbrowser.dart
index 51f0a6b3..378b0126 100644
--- a/lib/flutter_inappbrowser.dart
+++ b/lib/flutter_inappbrowser.dart
@@ -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
+ ///
+ ///```
+ ///
+ ///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);
diff --git a/pubspec.yaml b/pubspec.yaml
index 7faa944a..df5b33fa 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -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
homepage: https://github.com/pichillilorenzo/flutter_inappbrowser