[gnome-maps/wip/mlundblad/es6] WIP: Use ES6 arrow notation



commit 97454f3308e845de275e28215eead2ed8e9bf306
Author: Marcus Lundblad <ml update uu se>
Date:   Fri Nov 10 23:45:20 2017 +0100

    WIP: Use ES6 arrow notation

 src/accountListBox.js   |   11 ++++-------
 src/application.js      |   34 ++++++++++++++++------------------
 src/checkIn.js          |    4 ++--
 src/checkInDialog.js    |   24 +++++++++++-------------
 src/contextMenu.js      |   26 +++++++++++---------------
 src/exportViewDialog.js |   23 ++++++++---------------
 src/favoritesPopover.js |   18 ++++++++----------
 src/geoJSONSource.js    |   40 +++++++++++++++++++---------------------
 src/geoclue.js          |   10 +++++-----
 src/geocodeService.js   |   10 ++++------
 src/graphHopper.js      |   22 +++++++++++-----------
 11 files changed, 99 insertions(+), 123 deletions(-)
---
diff --git a/src/accountListBox.js b/src/accountListBox.js
index df5eb4c..e45a21e 100644
--- a/src/accountListBox.js
+++ b/src/accountListBox.js
@@ -61,11 +61,10 @@ var AccountListBox = new Lang.Class({
         params.activate_on_single_click = true;
         this.parent(params);
 
-        Application.checkInManager.connect('accounts-refreshed', this.refresh.bind(this));
+        Application.checkInManager.connect('accounts-refreshed', () => { this.refresh(); });
 
-        this.connect('row-activated', (function(list, row) {
-            this.emit('account-selected', row.account);
-        }).bind(this));
+        this.connect('row-activated',
+                     (list, row) => { this.emit('account-selected', row.account); });
 
         this.refresh();
     },
@@ -77,8 +76,6 @@ var AccountListBox = new Lang.Class({
             row.destroy();
         });
 
-        accounts.forEach((function(account) {
-            this.add(new AccountRow({ account: account }));
-        }).bind(this));
+        accounts.forEach((account) => { this.add(new AccountRow({ account: account })); });
     }
 });
diff --git a/src/application.js b/src/application.js
index 9cc5888..c155ba3 100644
--- a/src/application.js
+++ b/src/application.js
@@ -87,9 +87,7 @@ var Application = new Lang.Class({
         GLib.set_application_name(_("Maps"));
 
         /* Needed to be able to use in UI files */
-        _ensuredTypes.forEach(function(type) {
-            GObject.type_ensure(type);
-        });
+        _ensuredTypes.forEach((type) => { GObject.type_ensure(type); });
 
         this.parent({ application_id: 'org.gnome.Maps',
                       flags: Gio.ApplicationFlags.HANDLES_OPEN });
@@ -105,7 +103,7 @@ var Application = new Lang.Class({
         this.add_main_option('version', 'v'.charCodeAt(0), GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
                              _("Show the version of the program"), null);
 
-        this.connect('handle-local-options', (function(app, options) {
+        this.connect('handle-local-options', (app, options) => {
             if (options.contains('local')) {
                 let variant = options.lookup_value('local', null);
                 this.local_tile_path = variant.deep_unpack();
@@ -119,7 +117,7 @@ var Application = new Lang.Class({
             }
 
             return -1;
-        }).bind(this));
+        });
     },
 
     _checkNetwork: function() {
@@ -127,17 +125,17 @@ var Application = new Lang.Class({
     },
 
     _showContact: function(id) {
-        contactStore.lookup(id, (function(contact) {
+        contactStore.lookup(id, (contact) => {
             this._mainWindow.markBusy();
             if (!contact) {
                 this._mainWindow.unmarkBusy();
                 return;
             }
-            contact.geocode((function() {
+            contact.geocode(() => {
                 this._mainWindow.unmarkBusy();
                 this._mainWindow.mapView.showContact(contact);
-            }).bind(this));
-        }).bind(this));
+            });
+        });
     },
 
     _onShowContactActivate: function(action, parameter) {
@@ -150,10 +148,10 @@ var Application = new Lang.Class({
         if (contactStore.state === Maps.ContactStoreState.LOADED) {
             this. _showContact(id);
         } else {
-            Utils.once(contactStore, 'notify::state', (function() {
+            Utils.once(contactStore, 'notify::state', () => {
                 if (contactStore.state === Maps.ContactStoreState.LOADED)
                     this._showContact(id);
-            }).bind(this));
+            });
         }
     },
 
@@ -165,13 +163,13 @@ var Application = new Lang.Class({
         let dialog = osmEdit.createAccountDialog(this._mainWindow, false);
 
         dialog.show();
-        dialog.connect('response', dialog.destroy.bind(dialog));
+        dialog.connect('response', () => { dialog.destroy(); });
     },
 
     _addContacts: function() {
-        contactStore.get_contacts().forEach(function(contact) {
+        contactStore.get_contacts().forEach((contact) => {
             contact.geocode(function() {
-                contact.get_places().forEach(function(p) {
+                contact.get_places().forEach((p) => {
                     if (!p.location)
                         return;
 
@@ -199,10 +197,10 @@ var Application = new Lang.Class({
         if (contactStore.state === Maps.ContactStoreState.LOADED) {
             this._addContacts();
         } else {
-            Utils.once(contactStore, 'notify::state', (function() {
+            Utils.once(contactStore, 'notify::state', () => {
                 if (contactStore.state === Maps.ContactStoreState.LOADED)
                     this._addContacts();
-            }).bind(this));
+            });
         }
     },
 
@@ -264,9 +262,9 @@ var Application = new Lang.Class({
         notificationManager = new NotificationManager.NotificationManager(overlay);
         this._mainWindow = new MainWindow.MainWindow({ application: this,
                                                        overlay: overlay });
-        this._mainWindow.connect('destroy', this._onWindowDestroy.bind(this));
+        this._mainWindow.connect('destroy', () => { this._onWindowDestroy(); });
         if (GLib.getenv('MAPS_DEBUG') === 'focus') {
-            this._mainWindow.connect('set-focus', function(window, widget) {
+            this._mainWindow.connect('set-focus', (window, widget) => {
                 log('* focus widget: %s'.format(widget));
             });
         }
diff --git a/src/checkIn.js b/src/checkIn.js
index d6849c5..d75d492 100644
--- a/src/checkIn.js
+++ b/src/checkIn.js
@@ -84,7 +84,7 @@ var CheckInManager = new Lang.Class({
         this._accountsCount = 0;
         this._authorizers = {};
 
-        accounts.forEach((function(object) {
+        accounts.forEach((object) => {
             if (!object.get_account())
                 return;
 
@@ -95,7 +95,7 @@ var CheckInManager = new Lang.Class({
             this._accounts.push(object);
 
             this._authorizers[accountId] = this._getBackend(object).createAuthorizer(object);
-        }).bind(this));
+        });
 
         this.emit('accounts-refreshed');
         this.notify('hasCheckIn');
diff --git a/src/checkInDialog.js b/src/checkInDialog.js
index 9b0b700..4761b61 100644
--- a/src/checkInDialog.js
+++ b/src/checkInDialog.js
@@ -85,20 +85,18 @@ var CheckInDialog = new Lang.Class({
             this._cancellable.cancel();
         }).bind(this));
 
-        Application.checkInManager.connect('accounts-refreshed', this._onAccountRefreshed.bind(this));
+        Application.checkInManager.connect('accounts-refreshed',
+                                           () => { this._onAccountRefreshed() });
 
         this._initHeaderBar();
         this._initWidgets();
     },
 
     _initHeaderBar: function() {
-        this._cancelButton.connect('clicked', (function() {
-            this._cancellable.cancel();
-        }).bind(this));
+        this._cancelButton.connect('clicked',
+                                   () => { this._cancellable.cancel(); });
 
-        this._okButton.connect('clicked', (function() {
-            this._startCheckInStep();
-        }).bind(this));
+        this._okButton.connect('clicked', () => { this._startCheckInStep(); });
     },
 
     _initWidgets: function() {
@@ -125,15 +123,15 @@ var CheckInDialog = new Lang.Class({
                                   this._foursquareOptionsBroadcastTwitterCheckButton,
                                   'active', Gio.SettingsBindFlags.DEFAULT);
 
-        this._accountListBox.connect('account-selected', (function(list, account) {
+        this._accountListBox.connect('account-selected', (list, account) => {
             this._account = account;
             this._startPlaceStep();
-        }).bind(this));
+        });
 
-        this._placeListBox.connect('place-selected', (function(list, place) {
+        this._placeListBox.connect('place-selected', (list, place) => {
             this._checkIn.place = place;
             this._startMessageStep();
-        }).bind(this));
+        });
     },
 
     vfunc_show: function() {
@@ -150,9 +148,9 @@ var CheckInDialog = new Lang.Class({
             this._account = Application.checkInManager.accounts[0];
             this._startPlaceStep();
         } else {
-            Mainloop.idle_add((function() {
+            Mainloop.idle_add(() => {
                 this.response(Response.FAILURE_CHECKIN_DISABLED);
-            }).bind(this));
+            });
         }
     },
 
diff --git a/src/contextMenu.js b/src/contextMenu.js
index 5306093..c80b42b 100644
--- a/src/contextMenu.js
+++ b/src/contextMenu.js
@@ -81,10 +81,8 @@ var ContextMenu = new Lang.Class({
         this._latitude = this._mapView.view.y_to_latitude(y);
 
         if (button === Gdk.BUTTON_SECONDARY) {
-            Mainloop.idle_add((function() {
-                // Need idle to avoid Clutter dead-lock on re-entrance
-                this.popup_at_pointer(event);
-            }).bind(this));
+            // Need idle to avoid Clutter dead-lock on re-entrance
+            Mainloop.idle_add(() => { this.popup_at_pointer(event); });
         }
     },
 
@@ -125,14 +123,14 @@ var ContextMenu = new Lang.Class({
                                                longitude: this._longitude,
                                                accuracy: 0 });
 
-        Application.geocodeService.reverse(location, null, (function(place) {
+        Application.geocodeService.reverse(location, null, (place) => {
             if (place) {
                 this._mapView.showPlace(place, false);
             } else {
                 let msg = _("Nothing found here!");
                 Application.notificationManager.showMessage(msg);
             }
-        }).bind(this));
+        });
     },
 
     _onGeoURIActivated: function() {
@@ -153,11 +151,11 @@ var ContextMenu = new Lang.Class({
             let dialog = osmEdit.createAccountDialog(this._mainWindow, true);
 
             dialog.show();
-            dialog.connect('response', (function(dialog, response) {
+            dialog.connect('response', (dialog, response) => {
                 dialog.destroy();
                 if (response === OSMAccountDialog.Response.SIGNED_IN)
                     this._addOSMLocation();
-            }).bind(this));
+            });
 
             return;
         }
@@ -182,13 +180,13 @@ var ContextMenu = new Lang.Class({
                                       this._latitude, this._longitude);
 
         dialog.show();
-        dialog.connect('response', (function(dialog, response) {
+        dialog.connect('response', (dialog, response) => {
             dialog.destroy();
             if (response === OSMEditDialog.Response.UPLOADED) {
                 Application.notificationManager.showMessage(
                     _("Location was added to the map, note that it may take a while before it shows on the 
map and in search results."));
             }
-        }).bind(this));
+        });
     },
 
     _activateExport: function() {
@@ -206,9 +204,7 @@ var ContextMenu = new Lang.Class({
             mapView: this._mapView
         });
 
-        dialog.connect('response', function() {
-            dialog.destroy();
-        });
+        dialog.connect('response', () => { dialog.destroy(); });
         dialog.show_all();
     },
 
@@ -216,12 +212,12 @@ var ContextMenu = new Lang.Class({
         if (this._mapView.view.state === Champlain.State.DONE) {
             this._activateExport();
         } else {
-            let notifyId = this._mapView.view.connect('notify::state', (function() {
+            let notifyId = this._mapView.view.connect('notify::state', () => {
                 if (this._mapView.view.state === Champlain.State.DONE) {
                     this._mapView.view.disconnect(notifyId);
                     this._activateExport();
                 }
-            }).bind(this));
+            });
         }
     }
 });
diff --git a/src/exportViewDialog.js b/src/exportViewDialog.js
index 243e48b..c946563 100644
--- a/src/exportViewDialog.js
+++ b/src/exportViewDialog.js
@@ -60,17 +60,11 @@ var ExportViewDialog = new Lang.Class({
         params.use_header_bar = true;
         this.parent(params);
 
-        this._cancelButton.connect('clicked', (function() {
-            this.response(Response.CANCEL);
-        }).bind(this));
-        this._exportButton.connect('clicked', this._exportView.bind(this));
-        this._filenameEntry.connect('changed',
-                                    this._onFileNameChanged.bind(this));
-        this._fileChooserButton.connect('file-set',
-                                        this._onFolderChanged.bind(this));
-
-        this._layersCheckButton.connect('toggled',
-                                        this._includeLayersChanged.bind(this));
+        this._cancelButton.connect('clicked', () => { this.response(Response.CANCEL); });
+        this._exportButton.connect('clicked', () => { this._exportView(); });
+        this._filenameEntry.connect('changed', () => { this._onFileNameChanged(); });
+        this._fileChooserButton.connect('file-set', () => { this._onFolderChanged(); });
+        this._layersCheckButton.connect('toggled', () => { this._includeLayersChanged() });
 
 
         this._folder = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES);
@@ -99,7 +93,8 @@ var ExportViewDialog = new Lang.Class({
         let height = surfaceHeight * this._scaleFactor;
 
         this._previewArea.set_size_request(width, height);
-        this._previewArea.connect('draw', this._drawPreview.bind(this));
+        this._previewArea.connect('draw',
+                                  (w, cr) => { this._drawPreview(w, cr); });
     },
 
     _drawPreview: function(widget, cr) {
@@ -176,9 +171,7 @@ var ExportViewDialog = new Lang.Class({
                 secondary_text: details
             });
 
-            dialog.connect('response', function() {
-                dialog.destroy();
-            });
+            dialog.connect('response', () => { dialog.destroy(); });
             dialog.show_all();
         }
     },
diff --git a/src/favoritesPopover.js b/src/favoritesPopover.js
index b6df29a..cd1a328 100644
--- a/src/favoritesPopover.js
+++ b/src/favoritesPopover.js
@@ -80,16 +80,16 @@ var FavoritesPopover = new Lang.Class({
         }).bind(this));
 
         this._entry.connect('changed',
-                            this._list.invalidate_filter.bind(this._list));
+                            () => { this._list.invalidate_filter(this._list); });
 
-        this._list.connect('row-activated', (function(list, row) {
+        this._list.connect('row-activated', (list, row) => {
             this.hide();
             this._mapView.showPlace(row.place, true);
-        }).bind(this));
+        });
 
-        this._list.set_filter_func((function(row) {
+        this._list.set_filter_func((row) => {
             return row.place.match(this._entry.text);
-        }).bind(this));
+        });
 
         this._updateList();
     },
@@ -106,12 +106,10 @@ var FavoritesPopover = new Lang.Class({
     },
 
     _updateList: function() {
-        this._list.forall(function(row) {
-            row.destroy();
-        });
+        this._list.forall((row) => { row.destroy(); });
 
         let rows = 0;
-        this._model.foreach((function(model, path, iter) {
+        this._model.foreach((model, path, iter) => {
             let place = model.get_value(iter, PlaceStore.Columns.PLACE);
 
             let row = new PlaceListRow.PlaceListRow({ place: place,
@@ -119,7 +117,7 @@ var FavoritesPopover = new Lang.Class({
                                                       can_focus: true });
             this._list.add(row);
             rows++;
-        }).bind(this));
+        });
 
         this.rows = rows;
     }
diff --git a/src/geoJSONSource.js b/src/geoJSONSource.js
index 09e66a3..0eef485 100644
--- a/src/geoJSONSource.js
+++ b/src/geoJSONSource.js
@@ -78,15 +78,15 @@ var GeoJSONSource = new Lang.Class({
         if (tile.get_state() === Champlain.State.DONE)
             return;
 
-        tile.connect('render-complete', (function(tile, data, size, error) {
+        tile.connect('render-complete', (tile, data, size, error) => {
             if(!error) {
                 tile.set_state(Champlain.State.DONE);
                 tile.display_content();
             } else if(this.next_source)
                 this.next_source.fill_tile(tile);
-        }).bind(this));
+        });
 
-        Mainloop.idle_add(this._renderTile.bind(this, tile));
+        Mainloop.idle_add(() => { this._renderTile(tile); });
     },
 
     _validate: function([lon, lat]) {
@@ -99,10 +99,10 @@ var GeoJSONSource = new Lang.Class({
     },
 
     _compose: function(coordinates) {
-        coordinates.forEach((function(coordinate) {
+        coordinates.forEach((coordinate) => {
             this._validate(coordinate);
             this._bbox.extend(coordinate[1], coordinate[0]);
-        }).bind(this));
+        });
     },
 
     _clampBBox: function() {
@@ -117,9 +117,7 @@ var GeoJSONSource = new Lang.Class({
     },
 
     _parsePolygon: function(coordinates) {
-        coordinates.forEach((function(coordinate) {
-            this._compose(coordinate);
-        }).bind(this));
+        coordinates.forEach((coordinate) => { this._compose(coordinate); });
     },
 
     _parsePoint: function(coordinates, properties) {
@@ -154,9 +152,9 @@ var GeoJSONSource = new Lang.Class({
             break;
 
         case 'MultiLineString':
-            geometry.coordinates.forEach((function(coordinate) {
+            geometry.coordinates.forEach((coordinate) => {
                 this._parseLineString(coordinate);
-            }).bind(this));
+            });
             break;
 
         case 'Polygon':
@@ -164,9 +162,9 @@ var GeoJSONSource = new Lang.Class({
             break;
 
         case 'MultiPolygon':
-            geometry.coordinates.forEach((function(coordinate) {
+            geometry.coordinates.forEach((coordinate) => {
                 this._parsePolygon(coordinate);
-            }).bind(this));
+            });
             break;
 
         case 'Point':
@@ -174,9 +172,9 @@ var GeoJSONSource = new Lang.Class({
             break;
 
         case 'MultiPoint':
-            geometry.coordinates.forEach((function(coordinate, properties) {
+            geometry.coordinates.forEach((coordinate, properties) => {
                 this._parsePoint(coordinate,properties);
-            }).bind(this));
+            });
             break;
 
         default:
@@ -190,9 +188,9 @@ var GeoJSONSource = new Lang.Class({
 
         switch(root.type) {
         case 'FeatureCollection':
-            root.features.forEach((function(feature) {
+            root.features.forEach((feature) => {
                 this._parseGeometry(feature.geometry, feature.properties);
-            }).bind(this));
+            });
             break;
 
         case 'Feature':
@@ -203,7 +201,7 @@ var GeoJSONSource = new Lang.Class({
             if (!root.geometries)
                 throw new Error(_("parse error"));
 
-            root.geometries.forEach(this._parseGeometry.bind(this));
+            root.geometries.forEach((g) => { this._parseGeometry(g); });
             break;
 
         default:
@@ -226,7 +224,7 @@ var GeoJSONSource = new Lang.Class({
                                            height: TILE_SIZE,
                                            content: content });
 
-        content.connect('draw', (function(canvas, cr) {
+        content.connect('draw', (canvas, cr) => {
             tile.set_surface(cr.getTarget());
             cr.setOperator(Cairo.Operator.CLEAR);
             cr.paint();
@@ -238,13 +236,13 @@ var GeoJSONSource = new Lang.Class({
                 return;
             }
 
-            tileJSON.features.forEach(function(feature) {
+            tileJSON.features.forEach((feature) => {
                 if (feature.type === TileFeature.POINT)
                     return;
 
                 let geoJSONStyleObj = GeoJSONStyle.GeoJSONStyle.parseSimpleStyle(feature.tags);
 
-                feature.geometry.forEach(function(geometry) {
+                feature.geometry.forEach((geometry) => {
                     let first = true;
                     cr.moveTo(0, 0);
                     cr.setLineWidth(geoJSONStyleObj.lineWidth);
@@ -276,7 +274,7 @@ var GeoJSONSource = new Lang.Class({
             });
 
             tile.emit('render-complete', null, 0, false);
-        }).bind(this));
+        });
 
         content.invalidate();
     }
diff --git a/src/geoclue.js b/src/geoclue.js
index 74e962b..f2f5949 100644
--- a/src/geoclue.js
+++ b/src/geoclue.js
@@ -75,7 +75,7 @@ var Geoclue = new Lang.Class({
         let id = 'org.gnome.Maps';
         let level = GClue.AccuracyLevel.EXACT;
 
-        GClue.Simple.new(id, level, null, (function(object, result) {
+        GClue.Simple.new(id, level, null, (object, result) => {
             try {
                 this._simple = GClue.Simple.new_finish(result);
             }
@@ -91,16 +91,16 @@ var Geoclue = new Lang.Class({
             }
 
             this._simple.connect('notify::location',
-                           this._onLocationNotify.bind(this));
-            this._simple.client.connect('notify::active', (function() {
+                                 () => { this._onLocationNotify() });
+            this._simple.client.connect('notify::active', () => {
                 this.state = this._simple.client.active ? State.ON : State.DENIED;
-            }).bind(this));
+            });
 
             this.state = State.ON;
             this._onLocationNotify(this._simple);
             if (callback)
                 callback(true);
-        }).bind(this));
+        });
     },
 
     _onLocationNotify: function(simple) {
diff --git a/src/geocodeService.js b/src/geocodeService.js
index 38a60c1..8c90cfb 100644
--- a/src/geocodeService.js
+++ b/src/geocodeService.js
@@ -47,14 +47,12 @@ var GeocodeService = new Lang.Class({
         }
         forward.bounded = false;
         forward.set_answer_count(answerCount);
-        forward.search_async(cancellable, function(forward, res) {
+        forward.search_async(cancellable, (forward, res) => {
             try {
                 let places = forward.search_finish(res);
 
                 if (places !== null) {
-                    places = places.map(function(p) {
-                        return new Place.Place({ place: p });
-                    });
+                    places = places.map((p) => { return new Place.Place({ place: p }); });
                 }
 
                 callback(places);
@@ -68,7 +66,7 @@ var GeocodeService = new Lang.Class({
         let reverse = Geocode.Reverse.new_for_location(location);
 
         Application.application.mark_busy();
-        reverse.resolve_async(cancellable, (function(reverse, res) {
+        reverse.resolve_async(cancellable, (reverse, res) => {
             Application.application.unmark_busy();
             try {
                 let place = new Place.Place({ place: reverse.resolve_finish(res) });
@@ -80,6 +78,6 @@ var GeocodeService = new Lang.Class({
                             e.message);
                 callback(null);
             }
-        }).bind(this));
+        });
     }
 });
diff --git a/src/graphHopper.js b/src/graphHopper.js
index afb049e..bd1281d 100644
--- a/src/graphHopper.js
+++ b/src/graphHopper.js
@@ -52,7 +52,7 @@ var GraphHopper = new Lang.Class({
     },
 
     _updateFromStored: function() {
-        Mainloop.idle_add((function() {
+        Mainloop.idle_add(() => {
             if (!this.storedRoute)
                 return;
 
@@ -62,13 +62,13 @@ var GraphHopper = new Lang.Class({
                                 time: this.storedRoute.time,
                                 bbox: this.storedRoute.bbox });
             this.storedRoute = null;
-        }).bind(this));
+        });
     },
 
     _queryGraphHopper: function(points, transportationType, callback) {
         let url = this._buildURL(points, transportationType);
         let msg = Soup.Message.new('GET', url);
-        this._session.queue_message(msg, (function(session, message) {
+        this._session.queue_message(msg, (session, message) => {
             try {
                 let result = this._parseMessage(message);
                 if (!result)
@@ -78,7 +78,7 @@ var GraphHopper = new Lang.Class({
             } catch (e) {
                 callback(null, e);
             }
-        }).bind(this));
+        });
     },
 
     fetchRoute: function(points, transportationType) {
@@ -88,7 +88,7 @@ var GraphHopper = new Lang.Class({
         }
 
         this._queryGraphHopper(points, transportationType,
-                               (function(result, exception) {
+                               (result, exception) => {
             if (exception) {
                 Application.notificationManager.showMessage(_("Route request failed."));
                 Utils.debug(e);
@@ -108,19 +108,19 @@ var GraphHopper = new Lang.Class({
                     this.route.update(route);
                 }
             }
-        }).bind(this));
+        });
     },
 
     fetchRouteAsync: function(points, transportationType, callback) {
         this._queryGraphHopper(points, transportationType,
-                               (function(result, exception) {
+                               (result, exception) => {
             if (result) {
                 let route = this._createRoute(result.paths[0]);
                 callback(route, exception);
             } else {
                 callback(null, exception);
             }
-        }).bind(this));
+        });
     },
 
     _buildURL: function(points, transportation) {
@@ -157,7 +157,7 @@ var GraphHopper = new Lang.Class({
         if (!Array.isArray(result.paths)) {
             Utils.debug("No route found");
             if (result.info && Array.isArray(result.info.errors)) {
-                result.info.errors.forEach(function({ message, details }) {
+                result.info.errors.forEach(({ message, details }) => {
                     Utils.debug("Message: " + message);
                     Utils.debug("Details: " + details);
                 });
@@ -194,7 +194,7 @@ var GraphHopper = new Lang.Class({
             time:        0,
             turnAngle:   0
         });
-        let rest = instructions.map((function(instr) {
+        let rest = instructions.map((instr) => {
             let type = this._createTurnPointType(instr.sign);
             let text = instr.text;
             if (type === Route.TurnPointType.VIA) {
@@ -210,7 +210,7 @@ var GraphHopper = new Lang.Class({
                 time:        instr.time,
                 turnAngle:   instr.turn_angle
             });
-        }).bind(this));
+        });
         return [startPoint].concat(rest);
     },
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]