[polari/wip/fmuellner/window-experiments: 7/15] roomStack: Store rooms in a Map
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/window-experiments: 7/15] roomStack: Store rooms in a Map
- Date: Thu, 21 Jul 2016 02:56:55 +0000 (UTC)
commit 45c691f0e468f301ef59ce12ea469247ecb34aed
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 ...
src/roomStack.js | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/roomStack.js b/src/roomStack.js
index 859a08b..6ede912 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();
@@ -61,7 +61,7 @@ const RoomStack = new Lang.Class({
},
_addView: function(id, view) {
- this._rooms[id] = view;
+ this._rooms.set(id, view);
this.add_named(view, id);
},
@@ -70,8 +70,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() {
@@ -84,7 +84,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]