Skip to content

Commit

Permalink
use 'change' event to limit vibration count, see #29
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Nov 8, 2022
1 parent aace337 commit cd2ff59
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions www/js/haptics-playground-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ const onDeviceReady = () => {
// Set up the input for the number of clicks that will be played by the "multi clicks" button.
const numberOfClicksInput = document.getElementById( 'number-of-clicks' );
numberOfClicksInput.value = 3; // initial value
numberOfClicksInput.addEventListener( 'input', () => {
numberOfClicksInput.addEventListener( 'change', () => {
const inputValueAsNumber = Number( numberOfClicksInput.value );
if ( inputValueAsNumber > 9 ) {
numberOfClicksInput.value = 9;
if ( inputValueAsNumber > 10 ) {
numberOfClicksInput.value = 10;
}
else if ( inputValueAsNumber < 1 ) {
numberOfClicksInput.value = 1;
else if ( inputValueAsNumber < 3 ) {
numberOfClicksInput.value = 3;
}
} );

Expand Down Expand Up @@ -411,7 +411,7 @@ const onDeviceReady = () => {
firstOption.text = '(select pattern file to load)';
loadablePatternFileSelector.add( firstOption );

fileList.forEach( ( fileName, index ) => {
fileList.forEach( fileName => {
const fileNameOption = document.createElement( 'option' );
fileNameOption.text = fileName;
loadablePatternFileSelector.add( fileNameOption, 1 );
Expand Down

0 comments on commit cd2ff59

Please sign in to comment.