Gazebo_simulation-Frontend/node_modules/.cache/babel-loader/f7f2f9719af494ab84b5fb65861...

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"}