WordPress/wp-includes/js/media/controllers/media-library.js
Scott Taylor b191013198 Media JS files:
* In media manifests, ditch IIFEs and global injection, these get dynamically scoped via Browserify
* Remove the `debug` option from `browserify:media`
* Add `jshint:media` to `jshint:corejs`
* Add a trailing newline to all new module files

Props iseulde.
See #28510.

Built from https://develop.svn.wordpress.org/trunk@31385


git-svn-id: http://core.svn.wordpress.org/trunk@31366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-09 16:01:29 +00:00

49 lines
1.1 KiB
JavaScript

/**
* wp.media.controller.MediaLibrary
*
* @class
* @augments wp.media.controller.Library
* @augments wp.media.controller.State
* @augments Backbone.Model
*/
var Library = require( './library.js' ),
MediaLibrary;
MediaLibrary = Library.extend({
defaults: _.defaults({
// Attachments browser defaults. @see media.view.AttachmentsBrowser
filterable: 'uploaded',
displaySettings: false,
priority: 80,
syncSelection: false
}, Library.prototype.defaults ),
/**
* @since 3.9.0
*
* @param options
*/
initialize: function( options ) {
this.media = options.media;
this.type = options.type;
this.set( 'library', wp.media.query({ type: this.type }) );
Library.prototype.initialize.apply( this, arguments );
},
/**
* @since 3.9.0
*/
activate: function() {
// @todo this should use this.frame.
if ( wp.media.frame.lastMime ) {
this.set( 'library', wp.media.query({ type: wp.media.frame.lastMime }) );
delete wp.media.frame.lastMime;
}
Library.prototype.activate.apply( this, arguments );
}
});
module.exports = MediaLibrary;