var ListenerMethods = require('reflux-core/lib/ListenerMethods'),
    ListenerMixin = require('./ListenerMixin'),
    _ = require('reflux-core/lib/utils');

module.exports = function(listenable,key){
    return {
        getInitialState: function(){
            if (!_.isFunction(listenable.getInitialState)) {
                return {};
            } else if (key === undefined) {
                return listenable.getInitialState();
            } else {
                return _.object([key],[listenable.getInitialState()]);
            }
        },
        componentDidMount: function(){
            _.extend(this,ListenerMethods);
            var me = this, cb = (key === undefined ? this.setState : function(v){
                if (typeof me.isMounted === "undefined" || me.isMounted() === true) {
                    me.setState(_.object([key],[v]));
                }
            });
            this.listenTo(listenable,cb);
        },
        componentWillUnmount: ListenerMixin.componentWillUnmount
    };
};

@@ -191,16 +191,17 @@
 ble,key)
+ 
 %7B%0A    re
@@ -234,32 +234,33 @@
 tate: function()
+ 
 %7B%0A            if
@@ -584,16 +584,17 @@
 nction()
+ 
 %7B%0A      
@@ -603,66 +603,38 @@
     
-_.extend(this,ListenerMethods);%0A            var me = this,
+var me = this,%0A               
  cb 
@@ -656,20 +656,18 @@
 fined ? 
-this
+me
 .setStat
@@ -685,93 +685,8 @@
 n(v)
-%7B%0A                if (typeof me.isMounted === %22undefined%22 %7C%7C me.isMounted() === true)
  %7B%0A 
@@ -747,32 +747,35 @@
                %7D
+);%0A
 %0A            %7D);
@@ -771,20 +771,48 @@
         
-%7D
+_.extend(me, ListenerMethods
 );%0A
+%0A
         
@@ -840,16 +840,17 @@
 tenable,
+ 
 cb);%0A   

Fix warning 'isMounted'