Media JS: Improve signature for `Workspace.add()` to accept two arguments instead of an ambiguous object. see #21390, [21820], [21821].

git-svn-id: https://develop.svn.wordpress.org/trunk@21901 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith 2012-09-18 22:41:51 +00:00
parent b2fb76008e
commit fd40ade3fb
1 changed files with 10 additions and 10 deletions

View File

@ -35,20 +35,20 @@
},
// Accepts an `id` and `options` for a view.
// Registers a view.
//
// `options` is either a `Backbone.View` constructor or an object that
// contains two keys: the `view` key is a `Backbone.View` constructor,
// and the `options` key are the options to be passed when the view is
// initialized.
// `id` is a unique ID for the view relative to the workflow instance.
// `constructor` is a `Backbone.View` constructor. `options` are the
// options to be passed when the view is initialized.
//
// Triggers the `add` and `add:VIEW_ID` events.
add: function( id, options ) {
add: function( id, constructor, options ) {
this.remove( id );
if ( _.isFunction( options ) )
options = { view: options };
this._pending[ id ] = options;
this.trigger( 'add add:' + id, options );
this._pending[ id ] = {
view: constructor,
options: options
};
this.trigger( 'add add:' + id, constructor, options );
return this;
},