hooks
Hooks
useRben
Usage
const [state, set] = useRben(props)
const { entires, size } = state
const handleChange = () => set(key, ['puts "hello"'])
props
is an objects containing Ruby code
useRuby
Usage
const [state, set] = useRuby(callback, input, timeStamp)
const { output, running } = state
const handleChange = (e) => set(e.target.value)
callback
is a function after running the codeinput
is a text of default Ruby code to runtimeStamp
is a number to delay running the code.
State interface
key | descriptions |
---|---|
error: null | Error | error message |
input: string | ruby code |
output: string | output message |
running: boolean | true when running code |
prevTime?: number | |
timeStamp: number | |
deltaTime?: number |
useDelay
Usage
const delay = useDelay(callback, timeStamp)
const handleChange = () => delay()
callback
is a function to run after a delay.timeStamp
is a number to delay time.