[polari/wip/fmuellner/misc-cleanups: 7/8] roomStack: Store rooms in a Map
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/misc-cleanups: 7/8] roomStack: Store rooms in a Map
- Date: Mon, 8 Aug 2016 09:49:17 +0000 (UTC)
commit 58bdf21cb3476c1ae1ae59375488ade8d97ed09a
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Jul 18 21:09:09 2016 +0200
roomStack: Store rooms in a Map
With the availability of the ECMA6 Map class in gjs, it's time to
phase out the old pattern of using objects as hash tables ...
https://bugzilla.gnome.org/show_bug.cgi?id=769582
src/roomStack.js | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/roomStack.js b/src/roomStack.js
index 80d161d..521dd80 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -24,7 +24,7 @@ const RoomStack = new Lang.Class({
this.parent(params);
this._sizeGroup = new Gtk.SizeGroup({ mode: Gtk.SizeGroupMode.VERTICAL });
- this._rooms = {};
+ this._rooms = new Map();
this._roomManager = ChatroomManager.getDefault();
@@ -52,7 +52,7 @@ const RoomStack = new Lang.Class({
},
_addView: function(id, view) {
- this._rooms[id] = view;
+ this._rooms.set(id, view);
this.add_named(view, id);
},
@@ -61,8 +61,8 @@ const RoomStack = new Lang.Class({
},
_roomRemoved: function(roomManager, room) {
- this._rooms[room.id].destroy();
- delete this._rooms[room.id];
+ this._rooms.get(room.id).destroy();
+ this._rooms.delete(room.id);
},
_activeRoomChanged: function(manager, room) {
@@ -74,7 +74,7 @@ const RoomStack = new Lang.Class({
if (!room)
return;
let sensitive = room && room.channel;
- this._rooms[room.id].inputSensitive = sensitive;
+ this._rooms.get(room.id).inputSensitive = sensitive;
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]