From 167b78ab0a8e933479781c945cecad4217b49749 Mon Sep 17 00:00:00 2001 From: kenzieschmoll Date: Fri, 26 Apr 2019 10:46:46 -0700 Subject: [PATCH 1/2] Add example to improve pub score. --- example/main.dart | 27 +++++++++++++++++++++++++++ lib/src/chrome.dart | 3 +-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 example/main.dart diff --git a/example/main.dart b/example/main.dart new file mode 100644 index 0000000..3b8ce34 --- /dev/null +++ b/example/main.dart @@ -0,0 +1,27 @@ +import 'package:browser_launcher/browser_launcher.dart'; + +const _googleUrl = 'https://www.google.com/'; +const _googleImagesUrl = 'https://www.google.com/imghp?hl=en'; + +void main() async { + // Launches a chrome browser with two tabs open to [_googleUrl] and + // [_googleImagesUrl]. + await Chrome.start([_googleUrl, _googleImagesUrl]); + print('launched Chrome'); + + // Pause briefly before opening Chrome with a debug port. + await Future.delayed(Duration(seconds: 3)); + + // Launches a chrome browser open to [_googleUrl]. Since we are launching with + // a debug port, we will use a variety of different launch configurations, + // such as launching in a new browser. + final chrome = await Chrome.startWithDebugPort([_googleUrl], debugPort: 8888); + print('launched Chrome with a debug port'); + + // When running this dart code, observe that the browser stays open for 3 + // seconds before we close it. + await Future.delayed(Duration(seconds: 3)); + + await chrome.close(); + print('closed Chrome'); +} diff --git a/lib/src/chrome.dart b/lib/src/chrome.dart index 7f1250b..c1c4084 100644 --- a/lib/src/chrome.dart +++ b/lib/src/chrome.dart @@ -60,8 +60,7 @@ class Chrome { /// Starts Chrome with the given arguments and a specific port. /// - /// Only one instance of Chrome can run at a time. Each url in [urls] will be - /// loaded in a separate tab. + /// Each url in [urls] will be loaded in a separate tab. static Future startWithDebugPort( List urls, { int debugPort, From 378ff52ef869ca8b19caec1ea0f207e64625b861 Mon Sep 17 00:00:00 2001 From: kenzieschmoll Date: Fri, 26 Apr 2019 15:10:43 -0700 Subject: [PATCH 2/2] review comments. --- CHANGELOG.md | 4 ++++ example/main.dart | 2 +- pubspec.yaml | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6da5766..5ce8990 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.1 + +- added example + ## 0.1.0 - initial release diff --git a/example/main.dart b/example/main.dart index 3b8ce34..a586de4 100644 --- a/example/main.dart +++ b/example/main.dart @@ -3,7 +3,7 @@ import 'package:browser_launcher/browser_launcher.dart'; const _googleUrl = 'https://www.google.com/'; const _googleImagesUrl = 'https://www.google.com/imghp?hl=en'; -void main() async { +Future main() async { // Launches a chrome browser with two tabs open to [_googleUrl] and // [_googleImagesUrl]. await Chrome.start([_googleUrl, _googleImagesUrl]); diff --git a/pubspec.yaml b/pubspec.yaml index 8780aba..1375c6e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: browser_launcher -description: A standardized way to launch web browsers. +description: A package that provides a standardized way to launch web browsers. -version: 0.1.0 +version: 0.1.1-dev author: Dart Team homepage: https://github.com/dart-lang/browser_launcher