Gazebo_simulation-Frontend/node_modules/.cache/babel-loader/621319cbdc2f1a46f754b3198faa2026.json
2020-12-31 20:18:50 +00:00

1 line
746 B
JSON

{"ast":null,"code":"import { useRef } from 'react';\nimport useWillUnmount from './useWillUnmount';\nimport useMounted from './useMounted';\n/**\n * Returns a controller object for setting a timeout that is properly cleaned up\n * once the component unmounts. New timeouts cancel and replace existing ones.\n */\n\nexport default function useTimeout() {\n var isMounted = useMounted();\n var handle = useRef();\n\n var clear = function clear() {\n return clearTimeout(handle.current);\n };\n\n useWillUnmount(clear);\n return {\n set: function set(fn, ms) {\n if (!isMounted()) return;\n clear();\n handle.current = setTimeout(fn, ms);\n },\n clear: clear\n };\n}","map":null,"metadata":{},"sourceType":"module"}