Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Unified Diff: examples/js/maps/demo.js

Issue 985123002: Move geocoder code to location related path. This CL only moves files, no functional change. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « examples/js/maps/BUILD.gn ('k') | examples/js/maps/geocoder.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/js/maps/demo.js
diff --git a/examples/js/maps/demo.js b/examples/js/maps/demo.js
deleted file mode 100644
index aa6e783c6314a5e9219a40132ce1ec831bf59f1c..0000000000000000000000000000000000000000
--- a/examples/js/maps/demo.js
+++ /dev/null
@@ -1,79 +0,0 @@
-#!mojo mojo:js_content_handler
-// Demonstate a Mojo wrapper for the Geocoder JSON API. The application
-// connects to geocoder_service.js which implements geocoder.mojom.
-// To run this application with mojo_shell, set DIR to be the absolute path
-// for this directory, then:
-// mojo_shell file://$DIR/demo.js
-
-define("main", [
- "console",
- "examples/js/maps/geocoder.mojom",
- "mojo/public/js/core",
- "mojo/public/js/unicode",
- "mojo/services/public/js/application",
- "third_party/js/url",
-], function(console, geocoder, core, unicode, application, url) {
-
- const Application = application.Application;
- const Geocoder = geocoder.Geocoder;
- const Result = geocoder.Result;
- const Location = geocoder.Location;
- const Status = geocoder.Status;
- const Options = geocoder.Options;
- const URL = url.URL;
-
- var geocoderService;
-
- function demoAddressToLocation() {
- console.log("Demo GeocoderServce.AddressToLocation()");
- var addr = "1365 Shorebird way, Mountain View, CA";
- geocoderService.addressToLocation(addr, new Options).then(
- function(rv) {
- if (rv.status == Status.OK) {
- for (var i = 0; i < rv.results.length; i++) {
- var address = rv.results[i].formatted_address;
- var location = rv.results[i].geometry.location;
- console.log("Latitude,longitude for \"" + address + "\":");
- console.log(location.latitude + ", " + location.longitude);
-
- console.log("");
- demoLocationToAddress();
- }
- } else {
- console.log("Geocoder request failed status=" + rv.status);
- }
- });
- }
-
- function demoLocationToAddress() {
- console.log("Demo GeocoderServce.LocationToAddress()");
- var coords = new Location({
- latitude: 37.41811752319336,
- longitude: -122.07335662841797,
- });
- geocoderService.locationToAddress(coords, new Options).then(
- function(rv) {
- if (rv.status == Status.OK) {
- for (var i = 0; i < rv.results.length; i++) {
- var address = rv.results[i].formatted_address;
- var location = rv.results[i].geometry.location;
- console.log("Latitude,longitude for \"" + address + "\":");
- console.log(location.latitude + ", " + location.longitude);
- }
- } else {
- console.log("Geocoder request failed status=" + rv.status);
- }
- });
- }
-
- class Demo extends Application {
- initialize() {
- var geocoderURL = new URL(this.url).resolve("geocoder_service.js");
- geocoderService = this.shell.connectToService(geocoderURL, Geocoder);
- demoAddressToLocation();
- }
- }
-
- return Demo;
-});
-
« no previous file with comments | « examples/js/maps/BUILD.gn ('k') | examples/js/maps/geocoder.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698