'scripts' => [
'resources/src/mediawiki.htmlform.checker.js',
],
- 'dependencies' => [
- 'jquery.throttle-debounce',
- ],
'targets' => [ 'desktop', 'mobile' ],
],
'mediawiki.htmlform.ooui' => [
// FIXME: mw.htmlform.Element also sets this to empty object
mw.htmlform = {};
+ function debounce( delay, callback ) {
+ var timeout;
+ return function () {
+ clearTimeout( timeout );
+ timeout = setTimeout( Function.prototype.apply.bind( callback, this, arguments ), delay );
+ };
+ }
+
/**
* @class mw.htmlform.Checker
*/
if ( $extraElements ) {
$e = $e.add( $extraElements );
}
- $e.on( events, $.debounce( 1000, this.validate.bind( this ) ) );
+ $e.on( events, debounce( 1000, this.validate.bind( this ) ) );
return this;
};