You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, cleanup operations only remove expired items but do not modify existing unwrapped values. You can control whether cleanup should wrap existing unwrapped items with the `wrapUnwrappedItems` option.
108
+
109
+
```javascript
110
+
// Only clean up expired items, leave unwrapped items as-is (default)
111
+
constcleanupOnly=cleanupFactory(localStorage, {
112
+
expiresInSeconds:3600,
113
+
});
114
+
115
+
// Clean up expired items AND wrap unwrapped items
This gives you fine-grained control over when existing data gets wrapped with expiration metadata.
123
+
124
+
#### Browser Idle Cleanup
125
+
126
+
By default, the library runs cleanup operations when the browser is idle, using the `requestIdleCallback` API when available, with a simple polyfill fallback for older browsers.
127
+
128
+
```javascript
129
+
// Cleanup will run when browser is idle (default behavior)
130
+
constidleCleanup=cleanupFactory(localStorage, {
131
+
expiresInSeconds:3600,
132
+
});
133
+
134
+
idleCleanup.runCleanup(); // Schedules cleanup for when browser is idle
0 commit comments