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 new file mode 100644 index 0000000..a586de4 --- /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'; + +Future 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, 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