one
Version:
One is a React framework for web, iOS, and Android apps.
14 lines (12 loc) • 619 B
JavaScript
function validateListener(sensor, intervalMs, onReading, onError) {
if (![
"accelerometer",
"gyroscope",
"magnetometer",
"deviceMotion"
].includes(sensor)) throw new TypeError("Motion.addListener requires a supported sensor");
if (!Number.isFinite(intervalMs) || intervalMs < 0 || intervalMs > 1e3) throw new RangeError("Motion.addListener intervalMs must be between 0 and 1000");
if (typeof onReading !== "function" || typeof onError !== "function") throw new TypeError("Motion.addListener requires reading and error callbacks");
}
export { validateListener };
//# sourceMappingURL=validate.native.js.map