namespace input { function stepUpdate ( ) { let active = true ; return function ( ) { const s = input . acceleration ( Dimension . Strength ) ; if ( ! active && s > 2000 ) { active = true ; return true ; } else if ( s < 1500 ) { active = false ; } return false ; } ; } function stepHandler ( ) { jacdac . accelerometerService . raiseCustomGestureEvent ( BeadGesture . Step ) ; } input . onCustomGesture ( BeadGesture . Step , stepUpdate ( ) , stepHandler ) ; function lightStepUpdate ( ) { let active = true ; return function ( ) { const s = input . acceleration ( Dimension . Strength ) ; if ( ! active && s > 1500 ) { active = true ; return true ; } else if ( s < 1200 ) { active = false ; } return false ; } ; } function lightStepHandler ( ) { jacdac . accelerometerService . raiseCustomGestureEvent ( BeadGesture . LightStep ) ; } input . onCustomGesture ( BeadGesture . LightStep , lightStepUpdate ( ) , lightStepHandler ) ; }