CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-store

tessl install tessl/npm-store@2.0.0

A localStorage wrapper for all browsers without using cookies or flash, providing persistent client-side storage with automatic fallback and plugin architecture

Agent Success

Agent success rate when using this tile

75%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.96x

Baseline

Agent success rate without this tile

78%

task.mdevals/scenario-1/

Cross-Browser Settings Manager

Build a settings manager that works reliably across different browser environments, including those with storage limitations or restrictions.

Requirements

Your settings manager should:

  1. Try multiple storage backends in priority order - Configure the system to attempt localStorage first, then sessionStorage, then cookieStorage, and finally fall back to in-memory storage
  2. Automatically select the first working storage - The system should test each storage mechanism and use the first one that works
  3. Report storage availability - Provide a way to check if persistent storage is currently enabled
  4. Work in all environments - Even if all persistent storage fails (e.g., Safari private mode), the system should still function using temporary storage

Test Cases

  • When the primary storage is available, settings persist across page reloads @test
  • When the primary storage fails but a fallback is available, settings are stored in the fallback @test
  • The system reports correct status about whether persistent storage is enabled @test
  • When all persistent storage fails, the system still functions with temporary storage @test

Implementation

@generates

API

/**
 * Creates a settings manager with automatic storage fallback
 *
 * @returns {Object} Settings manager instance with the following methods:
 *   - get(key, defaultValue): Retrieve a setting value
 *   - set(key, value): Store a setting value
 *   - isEnabled(): Returns true if persistent storage is available
 */
function createSettingsManager() {
  // IMPLEMENTATION HERE
}

module.exports = { createSettingsManager };

Dependencies { .dependencies }

store { .dependency }

Provides cross-browser storage with automatic fallback mechanisms.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/store@2.0.x
tile.json