Fix repository delte notification and CLOSE buffering
This commit is contained in:
@@ -63,3 +63,7 @@ export function cached<T, V, Args extends any[]>({
|
||||
|
||||
return get
|
||||
}
|
||||
|
||||
export function simpleCache<V, Args extends any[]>(getValue: (args: Args) => V) {
|
||||
return cached({maxSize: 10**10, getKey: xs => xs.join(':'), getValue})
|
||||
}
|
||||
|
||||
+18
-4
@@ -311,11 +311,25 @@ export const batch = <T>(t: number, f: (xs: T[]) => void) => {
|
||||
}
|
||||
}
|
||||
|
||||
export const addToMapKey = <K, T>(m: Map<K, Set<T>>, k: K, v: T) => {
|
||||
const a = m.get(k) || new Set<T>()
|
||||
export const addToKey = <T>(m: Record<string, Set<T>>, k: string, v: T) => {
|
||||
const s = m[k] || new Set<T>()
|
||||
|
||||
a.add(v)
|
||||
m.set(k, a)
|
||||
s.add(v)
|
||||
m[k] = s
|
||||
}
|
||||
|
||||
export const pushToKey = <T>(m: Record<string, T[]>, k: string, v: T) => {
|
||||
const a = m[k] || []
|
||||
|
||||
a.push(v)
|
||||
m[k] = a
|
||||
}
|
||||
|
||||
export const addToMapKey = <K, T>(m: Map<K, Set<T>>, k: K, v: T) => {
|
||||
const s = m.get(k) || new Set<T>()
|
||||
|
||||
s.add(v)
|
||||
m.set(k, s)
|
||||
}
|
||||
|
||||
export const pushToMapKey = <K, T>(m: Map<K, T[]>, k: K, v: T) => {
|
||||
|
||||
Reference in New Issue
Block a user