Skip to content

Commit

Permalink
Merge pull request #49 from andrewbotz/skip-debounce
Browse files Browse the repository at this point in the history
Add ability to skip debounce
  • Loading branch information
kallookoo authored Sep 22, 2023
2 parents 02fbef7 + 9a43a40 commit 79358a9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/wp-color-picker-alpha.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
alphaReset: false,
alphaColorType: 'hex',
alphaColorWithSpace: false,
alphaSkipDebounce: false,
} );

this._super();
Expand Down Expand Up @@ -146,7 +147,11 @@
}
};

input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) );
input.on( 'change', callback );

if( ! self.alphaOptions.alphaSkipDebounce ) {
input.on( 'keyup', self._debounce( callback, debounceTimeout ) );
}

// If we initialized hidden, show on first focus. The rest is up to you.
if ( self.options.hide ) {
Expand Down Expand Up @@ -408,6 +413,7 @@
alphaReset: false,
alphaColorType: 'rgb',
alphaColorWithSpace: false,
alphaSkipDebounce: ( !!el.data( 'alphaSkipDebounce' ) || false ),
};

if ( options.alphaEnabled ) {
Expand Down

0 comments on commit 79358a9

Please sign in to comment.