|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <meta charset="UTF-8" /> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 6 | + <title>Expirix Playground</title> |
| 7 | + <style> |
| 8 | + body { |
| 9 | + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", |
| 10 | + sans-serif; |
| 11 | + margin: 0; |
| 12 | + padding: 40px; |
| 13 | + background: #f8fafc; |
| 14 | + color: #2d3748; |
| 15 | + line-height: 1.6; |
| 16 | + } |
| 17 | + |
| 18 | + .container { |
| 19 | + max-width: 800px; |
| 20 | + margin: 0 auto; |
| 21 | + background: white; |
| 22 | + padding: 40px; |
| 23 | + border-radius: 12px; |
| 24 | + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); |
| 25 | + } |
| 26 | + |
| 27 | + h1 { |
| 28 | + font-size: 2.5rem; |
| 29 | + margin-bottom: 10px; |
| 30 | + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| 31 | + -webkit-background-clip: text; |
| 32 | + -webkit-text-fill-color: transparent; |
| 33 | + background-clip: text; |
| 34 | + } |
| 35 | + |
| 36 | + .subtitle { |
| 37 | + font-size: 1.2rem; |
| 38 | + color: #718096; |
| 39 | + margin-bottom: 30px; |
| 40 | + } |
| 41 | + |
| 42 | + .instructions { |
| 43 | + background: #edf2f7; |
| 44 | + padding: 20px; |
| 45 | + border-radius: 8px; |
| 46 | + margin-bottom: 20px; |
| 47 | + } |
| 48 | + |
| 49 | + .instructions h3 { |
| 50 | + margin-top: 0; |
| 51 | + color: #2d3748; |
| 52 | + } |
| 53 | + |
| 54 | + code { |
| 55 | + background: #e2e8f0; |
| 56 | + padding: 2px 6px; |
| 57 | + border-radius: 4px; |
| 58 | + font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, |
| 59 | + monospace; |
| 60 | + font-size: 0.9em; |
| 61 | + } |
| 62 | + |
| 63 | + .code-block { |
| 64 | + background: #2d3748; |
| 65 | + color: #e2e8f0; |
| 66 | + padding: 20px; |
| 67 | + border-radius: 8px; |
| 68 | + font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, |
| 69 | + monospace; |
| 70 | + overflow-x: auto; |
| 71 | + margin: 15px 0; |
| 72 | + white-space: pre; |
| 73 | + line-height: 1.5; |
| 74 | + } |
| 75 | + |
| 76 | + .status { |
| 77 | + background: #c6f6d5; |
| 78 | + color: #22543d; |
| 79 | + padding: 10px 15px; |
| 80 | + border-radius: 6px; |
| 81 | + margin-top: 20px; |
| 82 | + border-left: 4px solid #38a169; |
| 83 | + } |
| 84 | + </style> |
| 85 | + </head> |
| 86 | + <body> |
| 87 | + <div class="container"> |
| 88 | + <h1>🚀 Expirix Playground</h1> |
| 89 | + <p class="subtitle"> |
| 90 | + Experiment with ephemeral storage in the browser console |
| 91 | + </p> |
| 92 | + |
| 93 | + <div class="instructions"> |
| 94 | + <h3>📖 How to use</h3> |
| 95 | + <p> |
| 96 | + Open your browser's developer console (F12 or Cmd+Option+I) and start |
| 97 | + experimenting! |
| 98 | + </p> |
| 99 | + |
| 100 | + <p><strong>Available global variables:</strong></p> |
| 101 | + <ul> |
| 102 | + <li> |
| 103 | + <code>storage</code> - Wrapped localStorage with 60 seconds expiry |
| 104 | + </li> |
| 105 | + <li> |
| 106 | + <code>wrapStorage</code> - The wrapStorage function to create your |
| 107 | + own instances |
| 108 | + </li> |
| 109 | + </ul> |
| 110 | + |
| 111 | + <p><strong>Try these commands:</strong></p> |
| 112 | + <div class="code-block">// Set a value that expires in 60 seconds |
| 113 | +storage.setItem("user", "John Doe") |
| 114 | + |
| 115 | +// Get the value |
| 116 | +storage.getItem("user") // "John Doe" |
| 117 | + |
| 118 | +// Wait 60+ seconds and try again |
| 119 | +storage.getItem("user") // null (expired) |
| 120 | + |
| 121 | +// Create your own storage with different expiry |
| 122 | +const quickStorage = wrapStorage(localStorage, { expiresInSeconds: 10 }) |
| 123 | +quickStorage.setItem("temp", "expires quickly") |
| 124 | + |
| 125 | +// Other methods |
| 126 | +storage.removeItem("user") |
| 127 | +storage.clear() |
| 128 | +storage.length |
| 129 | +storage.key(0)</div> |
| 130 | + </div> |
| 131 | + |
| 132 | + <div class="status"> |
| 133 | + ✅ Library loaded and ready! Check the console for the |
| 134 | + <code>storage</code> variable. |
| 135 | + </div> |
| 136 | + </div> |
| 137 | + |
| 138 | + <script type="module" src="./main.js"></script> |
| 139 | + </body> |
| 140 | +</html> |
0 commit comments