mirror of
https://github.com/sstent/aicyclingcoach-go.git
synced 2026-01-27 01:22:18 +00:00
sync
This commit is contained in:
19
node_modules/@react-leaflet/core/lib/events.js
generated
vendored
Normal file
19
node_modules/@react-leaflet/core/lib/events.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
export function useEventHandlers(element, eventHandlers) {
|
||||
const eventHandlersRef = useRef();
|
||||
useEffect(function addEventHandlers() {
|
||||
if (eventHandlers != null) {
|
||||
element.instance.on(eventHandlers);
|
||||
}
|
||||
eventHandlersRef.current = eventHandlers;
|
||||
return function removeEventHandlers() {
|
||||
if (eventHandlersRef.current != null) {
|
||||
element.instance.off(eventHandlersRef.current);
|
||||
}
|
||||
eventHandlersRef.current = null;
|
||||
};
|
||||
}, [
|
||||
element,
|
||||
eventHandlers
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user