File tree 1 file changed +18
-7
lines changed 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
- * React-Backbone.Glue 0.1.0 <https://github.com/Volicon/react-backbone.glue>
2
+ * React-Backbone.Glue 0.1.1 <https://github.com/Volicon/react-backbone.glue>
3
3
* (c) 2015 Vlad Balin & Volicon
4
4
* Released under MIT @license
5
5
*/
172
172
// new element instance needs to be created on next render...
173
173
if ( this . element ) {
174
174
this . element = null ;
175
-
176
- if ( this . component && this . component . trigger ) {
177
- this . stopListening ( this . component ) ;
178
- }
179
-
180
- this . component = null ;
175
+ this . unmountComponent ( ) ;
181
176
}
182
177
183
178
return Backbone . View . prototype . setElement . apply ( this , arguments ) ;
186
181
// cached instance of react component...
187
182
component : null ,
188
183
184
+ unmountComponent : function ( ) {
185
+ if ( this . component ) {
186
+ if ( this . component . trigger ) {
187
+ this . stopListening ( this . component ) ;
188
+ }
189
+
190
+ React . unmountComponentAtNode ( this . el ) ;
191
+ this . component = null ;
192
+ }
193
+ } ,
194
+
189
195
render : function ( ) {
190
196
if ( ! this . element ) {
191
197
this . element = React . createElement . apply ( React , this . _args ) ;
199
205
this . trigger . apply ( this , arguments ) ;
200
206
} ) ;
201
207
}
208
+ } ,
209
+
210
+ dispose : function ( ) {
211
+ this . unmountComponent ( ) ;
212
+ Backbone . View . prototype . dispose . apply ( this , arguments ) ;
202
213
}
203
214
} ) ;
204
215
You can’t perform that action at this time.
0 commit comments