Conversation
…hat into colinmacdonald/17-render-url
…-memory Conflicts: index.js
…e-memory Conflicts: README.md component.json index.js lib/view.js test/index.html test/index.js test/view.js
var tasks = [ | ||
this._view.initialize, | ||
_.bind(this._userCache.initialize, this._userCache), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to do the bindAll in the constructor just for view#initialize. Can just bind view#initialize in the same way as the usercache#initialize here.
this._wrapper.parentNode.removeChild(this._wrapper); | ||
} | ||
if (this._wrapper) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spacing between the if statements
Chat.prototype._collapseClick = function() { | ||
var userKey = this._userCache.getLocalUserKey(); | ||
this._view.toggleCollapse(); | ||
userKey.key(WIDGET_NAMESPACE).key('collapsed').set(this._view._collapsed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if view._collapsed is being used publicly it should just be view.collapsed
. Or just leave it _.collapsed
and add a getter method in view.
@@ -38,7 +38,7 @@ var VALID_POSITIONS = ['left', 'right']; | |||
|
|||
var defaultOpts = { | |||
room: null, | |||
collapsed: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can just leave this to the default false
and do your check in the view the other way around. The default should be left as false, because that is still the default when you load up chat for the first time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not anymore. Look at the top of the index.js file. Default is null, otherwise I have no way to check that collapsed param wasn't set by the user. Thats what the whole _.isBoolean(this.collapsed) check is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here can be done the other way around:
Line 106 in 755afa4
// If the collapsed param is specified, we use it, otherwise |
first check for the collpased param on the userObj, if it does not exist use the default of false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disregard the above. It is implemented as intended.
@@ -88,6 +88,7 @@ module.exports = Chat; | |||
|
|||
this._room = validOpts.room; | |||
this._messageExpiry = validOpts.messageExpiry; | |||
this._collapseKey = this._room.self().key(WIDGET_NAMESPACE).key('collapsed'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused member var
Closes #29
View initialize now calls back
Key is set when you toggle the collapse
Key is used to set initial toggle status