(delay = 900, useThrottle?: boolean)
| 39 | let debouncedGC: Map<number, () => void>; |
| 40 | |
| 41 | export function queueGC(delay = 900, useThrottle?: boolean) { |
| 42 | /** |
| 43 | * developers can use different queueGC settings to optimize their own apps |
| 44 | * each setting is stored in a Map to reuse each time app calls it |
| 45 | */ |
| 46 | if (useThrottle) { |
| 47 | if (!throttledGC) { |
| 48 | throttledGC = new Map(); |
| 49 | } |
| 50 | if (!throttledGC.get(delay)) { |
| 51 | throttledGC.set( |
| 52 | delay, |
| 53 | throttle(() => GC(), delay), |
| 54 | ); |
| 55 | } |
| 56 | throttledGC.get(delay)(); |
| 57 | } else { |
| 58 | if (!debouncedGC) { |
| 59 | debouncedGC = new Map(); |
| 60 | } |
| 61 | if (!debouncedGC.get(delay)) { |
| 62 | debouncedGC.set( |
| 63 | delay, |
| 64 | debounce(() => GC(), delay), |
| 65 | ); |
| 66 | } |
| 67 | debouncedGC.get(delay)(); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | export function releaseNativeObject(object: NSObject) { |
| 72 | __releaseNativeCounterpart(object); |
no test coverage detected