Changeset 21901
- Timestamp:
- 09/18/2012 10:41:51 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-views.js
r21898 r21901 36 36 37 37 38 // Accepts an `id` and `options` fora view.38 // Registers a view. 39 39 // 40 // `options` is either a `Backbone.View` constructor or an object that 41 // contains two keys: the `view` key is a `Backbone.View` constructor, 42 // and the `options` key are the options to be passed when the view is 43 // initialized. 40 // `id` is a unique ID for the view relative to the workflow instance. 41 // `constructor` is a `Backbone.View` constructor. `options` are the 42 // options to be passed when the view is initialized. 44 43 // 45 44 // Triggers the `add` and `add:VIEW_ID` events. 46 add: function( id, options ) {45 add: function( id, constructor, options ) { 47 46 this.remove( id ); 48 if ( _.isFunction( options ) ) 49 options = { view: options }; 50 this._pending[ id ] = options; 51 this.trigger( 'add add:' + id, options ); 47 this._pending[ id ] = { 48 view: constructor, 49 options: options 50 }; 51 this.trigger( 'add add:' + id, constructor, options ); 52 52 return this; 53 53 },
Note: See TracChangeset
for help on using the changeset viewer.