🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@semantq/state

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@semantq/state - npm Package Compare versions

Comparing version
1.0.3
to
1.0.4
+23
test.html
<!DOCTYPE html>
<html lang="en">
<head><title>Persistence Test</title></head>
<body>
<script type="module">
import { pulse } from './core/pulse.js'; // adjust path as needed
const testState = pulse({ count: 0 }, { key: 'test-persist', storage: sessionStorage });
console.log('Initial testState.value:', testState.value);
console.log('Initial sessionStorage:', sessionStorage.getItem('test-persist'));
setTimeout(() => {
testState.value = { count: testState.value.count + 1 };
console.log('Updated testState.value:', testState.value);
console.log('SessionStorage after update:', sessionStorage.getItem('test-persist'));
const reloadedState = pulse(null, { key: 'test-persist', storage: sessionStorage });
console.log('Reloaded testState.value from storage:', reloadedState.value);
}, 1000);
</script>
</body>
</html>
+5
-5

@@ -1,2 +0,1 @@

// pulse.js
import { PulseCore } from './PulseCore.js';

@@ -6,3 +5,3 @@

const { key, storage = localStorage } = options;
// Load from storage if key is provided

@@ -20,4 +19,5 @@ if (key) {

const signal = new PulseCore(initialValue);
// Pass options to PulseCore to enable persistence!
const signal = new PulseCore(initialValue, { key, storage });
return new Proxy(signal, {

@@ -39,2 +39,2 @@ get(target, prop) {

export const $state = pulse;
export const $state = pulse;
{
"name": "@semantq/state",
"version": "1.0.3",
"version": "1.0.4",
"description": "A reactive state management system for Semantq",

@@ -5,0 +5,0 @@ "main": "./core/index.js",