cleanup: Use optional chaining and ?? operator

Those operators have been supported since gjs switched to mozjs78
last cycle. While not ground-breaking, using it makes for a nice
cleanup here and there.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1517>
This commit is contained in:
Florian Müllner
2020-08-12 20:59:01 +02:00
committed by Marge Bot
parent c9df2f9370
commit 40e22eb524
18 changed files with 36 additions and 37 deletions

View File

@ -124,7 +124,7 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
return source;
}
let appId = ndata ? ndata.hints['desktop-entry'] || null : null;
const appId = ndata?.hints['desktop-entry'];
source = new FdoNotificationDaemonSource(title, pid, sender, appId);
this._sources.push(source);
@ -528,10 +528,10 @@ class GtkNotificationDaemonNotification extends MessageTray.Notification {
});
}
this._defaultAction = defaultAction ? defaultAction.unpack() : null;
this._defaultAction = defaultAction?.unpack();
this._defaultActionTarget = defaultActionTarget;
this.update(title.unpack(), body ? body.unpack() : null,
this.update(title.unpack(), body?.unpack(),
{ gicon: gicon ? Gio.icon_deserialize(gicon) : null,
datetime: time ? GLib.DateTime.new_from_unix_local(time.unpack()) : null });
}