Changeset 21689
- Timestamp:
- 08/31/2012 06:38:32 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-models.js
r21683 r21689 146 146 this.filters = options.filters || {}; 147 147 148 if ( options. watch)149 this. watch( options.watch);148 if ( options.observe ) 149 this.observe( options.observe ); 150 150 151 151 if ( options.mirror ) … … 153 153 }, 154 154 155 validat e: function( attachment ) {155 validator: function( attachment ) { 156 156 return _.all( this.filters, function( filter ) { 157 157 return !! filter.call( this, attachment ); … … 159 159 }, 160 160 161 changed: function( attachment, options ) { 162 163 if ( this.validate( attachment ) ) 164 this.add( attachment ); 165 else 166 this.remove( attachment ); 167 return this; 168 }, 169 170 watch: function( attachments ) { 171 attachments.on( 'add change', this.changed, this ); 172 }, 173 174 unwatch: function( attachments ) { 175 attachments.off( 'add change', this.changed, this ); 161 validate: function( attachment, options ) { 162 return this[ this.validator( attachment ) ? 'add' : 'remove' ]( attachment, options ); 163 }, 164 165 observe: function( attachments ) { 166 attachments.on( 'add change', this.validate, this ); 167 }, 168 169 unobserve: function( attachments ) { 170 attachments.off( 'add change', this.validate, this ); 176 171 }, 177 172 … … 319 314 } 320 315 321 this. watch( Attachments.all );316 this.observe( Attachments.all ); 322 317 }, 323 318
Note: See TracChangeset
for help on using the changeset viewer.