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:
parent
b2fb76008e
commit
fd40ade3fb
@ -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
|
// `id` is a unique ID for the view relative to the workflow instance.
|
||||||
// contains two keys: the `view` key is a `Backbone.View` constructor,
|
// `constructor` is a `Backbone.View` constructor. `options` are the
|
||||||
// and the `options` key are the options to be passed when the view is
|
// options to be passed when the view is initialized.
|
||||||
// initialized.
|
|
||||||
//
|
//
|
||||||
// Triggers the `add` and `add:VIEW_ID` events.
|
// Triggers the `add` and `add:VIEW_ID` events.
|
||||||
add: function( id, options ) {
|
add: function( id, constructor, options ) {
|
||||||
this.remove( id );
|
this.remove( id );
|
||||||
if ( _.isFunction( options ) )
|
this._pending[ id ] = {
|
||||||
options = { view: options };
|
view: constructor,
|
||||||
this._pending[ id ] = options;
|
options: options
|
||||||
this.trigger( 'add add:' + id, options );
|
};
|
||||||
|
this.trigger( 'add add:' + id, constructor, options );
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user