react-jsbox
Advanced tools
Comparing version 0.0.29 to 0.0.30
{ | ||
"name": "react-jsbox", | ||
"version": "0.0.29", | ||
"version": "0.0.30", | ||
"description": "A Custom React Renderer for writing JSBox apps in React.", | ||
@@ -72,2 +72,3 @@ "keywords": [ | ||
"eslint-plugin-react-hooks": "^1.6.0", | ||
"react": "alpha", | ||
"rollup": "^1.13.0", | ||
@@ -74,0 +75,0 @@ "rollup-plugin-babel": "^4.3.2", |
@@ -28,7 +28,7 @@ import {useEffect, useState} from 'react' | ||
field: { | ||
x: null, | ||
y: null, | ||
z: null | ||
x: 0, | ||
y: 0, | ||
z: 0 | ||
}, | ||
accuracy: null | ||
accuracy: -1 | ||
}, | ||
@@ -56,6 +56,3 @@ rotationRate: { | ||
useEffect(() => { | ||
const handler = resp => { | ||
setState(resp) | ||
} | ||
const handler = resp => setState(resp) | ||
$motion.startUpdates({ | ||
@@ -62,0 +59,0 @@ interval: 1 / 30, |
@@ -24,2 +24,3 @@ import {useEffect, useState} from 'react' | ||
const [state, setState] = useState(initialState) | ||
const [error, setError] = useState(null) | ||
@@ -31,2 +32,11 @@ useEffect(() => { | ||
setState(summary) | ||
}, | ||
didTimeout(summary) { | ||
setError({type: 'Timeout', body: summary}) | ||
}, | ||
didFail(error) { | ||
setError({type: 'Fail', body: error}) | ||
}, | ||
didFailToSendPing(response) { | ||
setError({type: 'FailToSendPing', body: response}) | ||
} | ||
@@ -38,5 +48,5 @@ }) | ||
return [state] | ||
return [state, error] | ||
} | ||
export default usePing |
Sorry, the diff of this file is too big to display
102940
811
23