Skip to content

Commit

Permalink
Bump to 0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
bseth99 committed Sep 20, 2013
1 parent d20b987 commit fe61792
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
32 changes: 26 additions & 6 deletions backbone-fiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,20 @@
this.$el.on( 'destroyed', _.bind( this.remove, this ) );

this.children = [];
this.setup();
this.setup( options );
this.bindData();

this.trigger('created');
},

/**
* Internal function to unbind any listenTos on the data
* Any custom setData functions need to call this or write their own version.
*/
unbindData: function() {
this.stopListening( this.data() );
},

/**
* Internal function to examine the events hash and
* look for *.data keys. Will bind the function identified in the value
Expand Down Expand Up @@ -397,17 +405,28 @@
return {};
},

/**
* Default logic to set data on the view. Takes a hash with either model or collection set to the new data value.
* Any custom functions must ensure they properly bind and unbind data. The trigger is optional.
* Returns itself for chaining.
*/

setData: function( data ) {

var dm = null;

this.unbindData();

if ( data.model )
this.model = data.model;
this.model = dm = data.model;
else if ( data.collection )
this.collection = data.collection;
this.collection = dm = data.collection;

this.bindData();

},
if (dm && dm.trigger) {dm.trigger('ready', dm);}
return this;
},

/**
* Ensures the data is a object
Expand All @@ -429,16 +448,17 @@
*/
remove: function() {

this.destroy();

if ( this.parent ) {

_view_inst[this.parent].removeChild( this );

} else {

this.destroy();
this.trigger('removed');
this.stopListening();
this.$el.off( 'destroyed' );
this.$el.remove();

delete _view_inst[this.cid];
}
Expand Down
2 changes: 1 addition & 1 deletion backbone-fiber.min.js

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

2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backbone-fiber",
"version": "0.0.3",
"version": "0.0.4",
"ignore": [
"bower_components",
"node_modules",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Backbone.Fiber",
"title": "",
"description": "",
"version": "0.0.3",
"version": "0.0.4",
"author": {
"name": "Ben Olson",
"url": "http://bseth99.github.com/"
Expand Down

0 comments on commit fe61792

Please sign in to comment.