Created
July 12, 2019 14:18
-
-
Save steveruizok/8665ae0bcd5f13c6841e9f6e33c1cafd to your computer and use it in GitHub Desktop.
The App.tsx file for the RGB LED example.
This file contains 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 { Override, Data } from "framer" | |
import { connectToHost } from "./Client" | |
// Socket | |
const serverUrl = "http://localhost:8080" | |
const responses = { | |
CONNECT: () => console.log("Connected"), | |
DISCONNECT: () => console.log("Disconnected"), | |
} | |
const dispatch = connectToHost(serverUrl, responses) | |
// Overrides | |
export function RedSlider(): Override { | |
return { | |
onValueChange: value => { | |
dispatch("CHANGE_COLOR", { | |
color: "red", | |
value: value, | |
}) | |
}, | |
} | |
} | |
export function GreenSlider(): Override { | |
return { | |
onValueChange: value => { | |
dispatch("CHANGE_COLOR", { | |
color: "green", | |
value: value, | |
}) | |
}, | |
} | |
} | |
export function BlueSlider(): Override { | |
return { | |
onValueChange: value => { | |
dispatch("CHANGE_COLOR", { | |
color: "blue", | |
value: value, | |
}) | |
}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment