2015-02-22 07:56:27 +01:00
|
|
|
/*globals _ */
|
|
|
|
|
2015-02-09 01:43:50 +01:00
|
|
|
/**
|
|
|
|
* wp.media.view.Spinner
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @augments wp.media.View
|
|
|
|
* @augments wp.Backbone.View
|
|
|
|
* @augments Backbone.View
|
|
|
|
*/
|
|
|
|
var View = require( './view.js' ),
|
|
|
|
Spinner;
|
|
|
|
|
|
|
|
Spinner = View.extend({
|
|
|
|
tagName: 'span',
|
|
|
|
className: 'spinner',
|
|
|
|
spinnerTimeout: false,
|
|
|
|
delay: 400,
|
|
|
|
|
|
|
|
show: function() {
|
|
|
|
if ( ! this.spinnerTimeout ) {
|
|
|
|
this.spinnerTimeout = _.delay(function( $el ) {
|
|
|
|
$el.show();
|
|
|
|
}, this.delay, this.$el );
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
|
|
|
hide: function() {
|
|
|
|
this.$el.hide();
|
|
|
|
this.spinnerTimeout = clearTimeout( this.spinnerTimeout );
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-02-09 17:01:29 +01:00
|
|
|
module.exports = Spinner;
|