Skip to content

Commit

Permalink
observ-style-hook: check that obs is present before calling
Browse files Browse the repository at this point in the history
  • Loading branch information
mmckegg committed Jun 2, 2016
1 parent 9f8bb0b commit 9279999
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/observ-style-hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function update(prop, getValue, value){

ObservStyleHook.prototype.hook = function(node, prop, prev){
var self = this
update.call(node, self.prop, self.getValue, self.obs())
if (typeof self.obs === 'function') {
update.call(node, self.prop, self.getValue, self.obs())
}
if (!prev || prev.obs !== self.obs){
self.removeListener && self.removeListener()
if (self.obs){
Expand All @@ -35,4 +37,4 @@ ObservStyleHook.prototype.unhook = function(node, prop, next){
} else {
this.removeListener && this.removeListener()
}
}
}

0 comments on commit 9279999

Please sign in to comment.