Skip to content

Commit

Permalink
Effects: Don't warn about interval if document is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
dmethvin committed Mar 23, 2018
1 parent 856931d commit 758a138
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,25 @@ jQuery.Tween.prototype.run = function( ) {
oldTweenRun.apply( this, arguments );
};

jQuery.fx.interval = jQuery.fx.interval || 13;
var intervalValue = jQuery.fx.interval || 13,
intervalMsg = "jQuery.fx.interval is deprecated";

// Support: IE9, Android <=4.4
// Avoid false positives on browsers that lack rAF
// Don't warn if document is hidden, jQuery uses setTimeout (#292)
if ( window.requestAnimationFrame ) {
migrateWarnProp( jQuery.fx, "interval", jQuery.fx.interval,
"jQuery.fx.interval is deprecated" );
Object.defineProperty( jQuery.fx, "interval", {
configurable: true,
enumerable: true,
get: function() {
if ( !window.document.hidden ) {
migrateWarn( intervalMsg );
}
return intervalValue;
},
set: function( newValue ) {
migrateWarn( intervalMsg );
intervalValue = newValue;
}
} );
}

0 comments on commit 758a138

Please sign in to comment.