Created
September 20, 2018 02:49
-
-
Save Sawtaytoes/d88ea19eea197bf48be6c362aab58e0f to your computer and use it in GitHub Desktop.
Flic Button listener for a single button press.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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