Skip to content

Instantly share code, notes, and snippets.

@Sawtaytoes
Created September 20, 2018 02:49
Show Gist options
  • Save Sawtaytoes/d88ea19eea197bf48be6c362aab58e0f to your computer and use it in GitHub Desktop.
Save Sawtaytoes/d88ea19eea197bf48be6c362aab58e0f to your computer and use it in GitHub Desktop.
Flic Button listener for a single button press.
import {
BUTTON_DOWN,
singlePressAction,
} from './actions'
const handleButtonPress = buttonState => (
buttonState === BUTTON_DOWN
&& singlePressAction()
)
const listenForButtonPress = bluetoothAddress => {
new FlicConnectionChannel(bluetoothAddress)
.on('buttonUpOrDown', handleButtonPress)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment