MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / dispatch

Function dispatch

web/pgadmin/static/js/custom_hooks.js:200–213  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

198 useEffect(()=>{
199 let ele = eleRef.current ?? document;
200 const dispatch = (e)=>{
201 Promise.resolve(0).then(()=>{
202 let allListeners = _.filter(shortcutsRef.current, (s)=>matchFound(s.shortcut, e));
203 for(const {options} of allListeners) {
204 Promise.resolve(0).then(()=>{
205 if(options.callback && (options.enabled ?? true)) {
206 e.preventDefault();
207 e.stopPropagation();
208 options.callback(e);
209 }
210 });
211 }
212 });
213 };
214 ele.addEventListener('keydown', dispatch);
215 return ()=>{
216 ele.removeEventListener('keydown', dispatch);

Callers 3

CellFunction · 0.85
ResultGridComponentFunction · 0.85
insertTabWithUnitFunction · 0.85

Calls 3

matchFoundFunction · 0.85
filterMethod · 0.80
callbackMethod · 0.45

Tested by

no test coverage detected