[gnome-shell-extensions] places-menu: Use spread operator for variadic function
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] places-menu: Use spread operator for variadic function
- Date: Wed, 21 Aug 2019 17:20:47 +0000 (UTC)
commit 2dc4325a906fb15a096bfec2ad36357f56c8ae19
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Aug 7 04:08:02 2019 +0200
places-menu: Use spread operator for variadic function
Invoking functions via Function.prototype.apply() and .call() is
less performant than a regular function call, and makes code harder
to read.
Before ES6 there was no other way of writing a function with variadic
arguments, but since we now have the spread operator, we can use that
as the better alternative.
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91
extensions/places-menu/placeDisplay.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index ff41eb0..a80e1a3 100644
--- a/extensions/places-menu/placeDisplay.js
+++ b/extensions/places-menu/placeDisplay.js
@@ -20,8 +20,8 @@ const Hostname1Iface = '<node> \
const Hostname1 = Gio.DBusProxy.makeProxyWrapper(Hostname1Iface);
class PlaceInfo {
- constructor() {
- this._init.apply(this, arguments);
+ constructor(...params) {
+ this._init(...params);
}
_init(kind, file, name, icon) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]