wp-media-picker.js
function() {
			var self = this;

			self._frame.on( 'insert', function() {
				var selection   = self._frame.state().get( 'selection' );
				var attachments = selection.models.map( function( model ) {
					return _.extend( {}, model.toJSON() );
				});
				var attachment  = _.extend( {}, selection.first().toJSON() );

				self._setAttachment( attachment );

				$( document ).trigger( 'wpMediaPicker.insert', [ attachments, self ] );
			});

			self._open_button.on( 'click', function() {
				var selection = self._frame.state( 'insert' ).get( 'selection' );
				selection.reset( self._attachment ? [ self._attachment ] : [] );

				self.open();
			});

			self._remove_button.on( 'click', function() {
				self._setAttachment( null );
			});
		}
function() {
			var self = this;

			self._frame.on( 'insert', function() {
				var selection   = self._frame.state().get( 'selection' );
				var attachments = selection.models.map( function( model ) {
					return _.extend( {}, model.toJSON() );
				});
				var attachment  = _.extend( {}, selection.first().toJSON() );

				self._setAttachment( attachment );

				$( document ).trigger( 'wpMediaPicker.insert', [ attachments, self ] );
			});

			self._open_button.on( 'click', function() {
				var selection = self._frame.state( 'insert' ).get( 'selection' );
				selection.reset( self._attachment ? [ self._attachment ] : [] );

				self.open();
			});

			self._remove_button.on( 'click', function() {
				self._setAttachment( null );
			});
		}
function ( ) { var self = this ; self . _frame . on ( 'insert' , function ( ) { var selection = self . _frame . state ( ) . get ( 'selection' ) ; var attachments = selection . models . map ( function ( model ) { return _ . extend ( { } , model . toJSON ( ) ) ; } ) ; var attachment = _ . extend ( { } , selection . first ( ) . toJSON ( ) ) ; self . _setAttachment ( attachment ) ; $ ( document ) . trigger ( 'wpMediaPicker.insert' , [ attachments , self ] ) ; } ) ; self . _open_button . on ( 'click' , function ( ) { var selection = self . _frame . state ( 'insert' ) . get ( 'selection' ) ; selection . reset ( self . _attachment ? [ self . _attachment ] : [ ] ) ; self . open ( ) ; } ) ; self . _remove_button . on ( 'click' , function ( ) { self . _setAttachment ( null ) ; } ) ; }
Adds event listeners for the media picker buttons and the media frame inserter.

@since 0.1.0

@returns {void}
Adds event listeners for the media picker buttons and the media frame inserter .