PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 1.9.0
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v1.9.0
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / Performance / Admin / package / preload / preload-id.js

preload-id.js in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 1.9.0, at src/Performance/Admin/package/preload/preload-id.js

34 lines 862 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Store the unique preload ID in order to prevent notifications from
3 * displaying over and over when the REST endpoint is polled.
4 */
5 const preloadIdKey = 'swpsp-preload-id';
6
7 export const PreloadId = {
8 /**
9 * Retrieve the preload ID from sessionStorage.
10 *
11 * @returns {string|null} The stored preload ID, or `null` if it doesn't exist.
12 */
13 get: () => sessionStorage.getItem(preloadIdKey),
14
15 /**
16 * Set the preload ID in sessionStorage.
17 *
18 * @param {string} id The preload ID to store.
19 */
20 set: (id) => sessionStorage.setItem(preloadIdKey, id),
21
22 /**
23 * Check if the preload ID exists in sessionStorage.
24 *
25 * @returns {boolean} `true` if the preload ID exists, otherwise `false`.
26 */
27 has: () => sessionStorage.getItem(preloadIdKey) !== null,
28
29 /**
30 * Clear the preload ID.
31 */
32 clear: () => sessionStorage.removeItem(preloadIdKey),
33 };
34