mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-23 08:41:24 +01:00
Themes: Use _.throttle() instead of a custom one. Props matveb. Fixes #25981
Built from https://develop.svn.wordpress.org/trunk@26467 git-svn-id: http://core.svn.wordpress.org/trunk@26365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f581667614
commit
a2607efe8b
@ -29,21 +29,12 @@ themes.view.Appearance = wp.Backbone.View.extend({
|
||||
|
||||
// Sets up a throttler for binding to 'scroll'
|
||||
initialize: function() {
|
||||
var self = this;
|
||||
// Scroller checks how far the scroll position is
|
||||
_.bindAll( this, 'scroller' );
|
||||
|
||||
// Keep a boolean check so that we don't run
|
||||
// too much code on every event trigger
|
||||
this.window.bind( 'scroll.themes', function() {
|
||||
this.throttle = true;
|
||||
});
|
||||
|
||||
setInterval( function() {
|
||||
if ( this.throttle ) {
|
||||
// Once the case is the case, the action occurs and the fact is no more
|
||||
this.throttle = false;
|
||||
self.scroller();
|
||||
}
|
||||
}, 300 );
|
||||
// Bind to the scroll event and throttle
|
||||
// the results from this.scroller
|
||||
this.window.bind( 'scroll', _.throttle( this.scroller, 300 ) );
|
||||
},
|
||||
|
||||
// Main render control
|
||||
|
2
wp-admin/js/theme.min.js
vendored
2
wp-admin/js/theme.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user