Skip to content

Instantly share code, notes, and snippets.

@steveruizok
Created July 12, 2019 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveruizok/8665ae0bcd5f13c6841e9f6e33c1cafd to your computer and use it in GitHub Desktop.
Save steveruizok/8665ae0bcd5f13c6841e9f6e33c1cafd to your computer and use it in GitHub Desktop.
The App.tsx file for the RGB LED example.
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