Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 2x 2x 4x 4x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x 4x 4x | import { courseStartTimeToEventRow } from '../constants/index'; import { SchedulerEvent } from '../types'; export const selectGroupsToShow = (schedulerEvents: Array<SchedulerEvent>, index: number) => { return schedulerEvents.filter((schedulerEvent) => courseStartTimeToEventRow[schedulerEvent.time] === index); }; //debounce declaration and implementation type Procedure = (...args: any[]) => any; interface Debounce { (...args: any[]): any; clear: () => void; flush: () => void; } export const debounce = (func: Procedure, wait: number, immediate: boolean = false) => { let timeout: number | null; let args: any; let context: any; let result: any; const later = () => { timeout = null; if (!immediate) { result = func.apply(context, args); context = args = null; } }; const debouncedFunc: Procedure = function (this: any) { context = this; args = arguments; const callNow = immediate && !timeout; Eif (!timeout) { timeout = window.setTimeout(later, wait); } Iif (callNow) { result = func.apply(context, args); context = args = null; } return result; }; const clear = () => { if (timeout) { clearTimeout(timeout); timeout = null; } }; const flush = () => { if (timeout) { result = func.apply(context, args); context = args = null; clearTimeout(timeout); timeout = null; } }; const debounced: Debounce = (() => { const f: any = debouncedFunc; f.clear = clear; f.flush = flush; return f; })(); return debounced; }; |