Skip to content

Commit

Permalink
Bug fixes and version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Balin committed Sep 9, 2015
1 parent 01363ef commit 95b4f59
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
],

"license": "MIT",
"version": "0.1.0",
"version": "0.1.1",

"scripts": {
"make:backbone:win" : "type .\\umd\\copyright.js .\\umd\\backbone-head.js .\\src\\glue.js .\\umd\\tail.js > .\\react-backbone.js",
Expand Down
25 changes: 18 additions & 7 deletions react-backbone.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* React-Backbone.Glue 0.1.0 <https://github.com/Volicon/react-backbone.glue>
* React-Backbone.Glue 0.1.1 <https://github.com/Volicon/react-backbone.glue>
* (c) 2015 Vlad Balin & Volicon
* Released under MIT @license
*/
Expand Down Expand Up @@ -172,12 +172,7 @@
// new element instance needs to be created on next render...
if( this.element ){
this.element = null;

if( this.component && this.component.trigger ){
this.stopListening( this.component );
}

this.component = null;
this.unmountComponent();
}

return Backbone.View.prototype.setElement.apply( this, arguments );
Expand All @@ -186,6 +181,17 @@
// cached instance of react component...
component : null,

unmountComponent : function(){
if( this.component ){
if( this.component.trigger ){
this.stopListening( this.component );
}

React.unmountComponentAtNode( this.el );
this.component = null;
}
},

render : function(){
if( !this.element ){
this.element = React.createElement.apply( React, this._args );
Expand All @@ -199,6 +205,11 @@
this.trigger.apply( this, arguments );
});
}
},

dispose : function(){
this.unmountComponent();
Backbone.View.prototype.dispose.apply( this, arguments );
}
});

Expand Down
4 changes: 2 additions & 2 deletions react-backbone.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions react-nested.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 17 additions & 6 deletions src/glue.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,7 @@ function reactBackboneGlue( Backbone, React ){
// new element instance needs to be created on next render...
if( this.element ){
this.element = null;

if( this.component && this.component.trigger ){
this.stopListening( this.component );
}

this.component = null;
this.unmountComponent();
}

return Backbone.View.prototype.setElement.apply( this, arguments );
Expand All @@ -171,6 +166,17 @@ function reactBackboneGlue( Backbone, React ){
// cached instance of react component...
component : null,

unmountComponent : function(){
if( this.component ){
if( this.component.trigger ){
this.stopListening( this.component );
}

React.unmountComponentAtNode( this.el );
this.component = null;
}
},

render : function(){
if( !this.element ){
this.element = React.createElement.apply( React, this._args );
Expand All @@ -184,6 +190,11 @@ function reactBackboneGlue( Backbone, React ){
this.trigger.apply( this, arguments );
});
}
},

dispose : function(){
this.unmountComponent();
Backbone.View.prototype.dispose.apply( this, arguments );
}
});

Expand Down
2 changes: 1 addition & 1 deletion umd/copyright.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* React-Backbone.Glue 0.1.0 <https://github.com/Volicon/react-backbone.glue>
* React-Backbone.Glue 0.1.1 <https://github.com/Volicon/react-backbone.glue>
* (c) 2015 Vlad Balin & Volicon
* Released under MIT @license
*/

0 comments on commit 95b4f59

Please sign in to comment.