/** * wp.media.view.Spinner * * @memberOf wp.media.view * * @class * @augments wp.media.View * @augments wp.Backbone.View * @augments Backbone.View */ var Spinner = wp.media.View.extend(/** @lends wp.media.view.Spinner.prototype */{ tagName: 'span', className: 'spinner', spinnerTimeout: false, delay: 400, show: function() { if ( ! this.spinnerTimeout ) { this.spinnerTimeout = _.delay(function( $el ) { $el.addClass( 'is-active' ); }, this.delay, this.$el ); } return this; }, hide: function() { this.$el.removeClass( 'is-active' ); this.spinnerTimeout = clearTimeout( this.spinnerTimeout ); return this; } }); module.exports = Spinner;