{"_id":"persist-and-sync","_rev":"13-c8946e586e037ee80391b74eafe73bb5","name":"persist-and-sync","dist-tags":{"latest":"1.2.3"},"versions":{"0.0.0":{"name":"persist-and-sync","version":"0.0.0","author":"","license":"ISC","_id":"persist-and-sync@0.0.0","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"dist":{"shasum":"5ff62ea6e9907be4f7f8e3a662a9f588c49092cd","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-0.0.0.tgz","fileCount":4,"integrity":"sha512-EV7CTw9U3GnBt5rwjfYRDYwu9ir+cwjYDNsfsjgeZGwKTt4pILq46Y8IsAtPM/hDszHz0XFeZQw0uVKNFf3tgg==","signatures":[{"sig":"MEQCIFob2KkZIgK0foJU6wb+hJHVa1gtHsBMBSL0YiErYwX+AiAyHXepOJNFrV61GGBWMr0gK4rvenwnWlJmkh/KDmTmlw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4238},"main":"index.js","types":"index.d.ts","gitHead":"24b95d3cc09aaa0015305622a6e668c18e86d040","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"_npmVersion":"9.5.0","description":"> Zustand middleware to easily persist and sync Zustand state between tabs / windows / iframes (SameOrigin)","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"peerDependencies":{"zustand":"^3 || ^4"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_0.0.0_1692989475131_0.4757533073044842","host":"s3://npm-registry-packages"}},"0.0.1":{"name":"persist-and-sync","version":"0.0.1","keywords":["web","api","broadcast","channel","broadcast-channel","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript"],"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","_id":"persist-and-sync@0.0.1","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"homepage":"https://github.com/mayank1513/nextjs-themes/tree/main/packages/persistnsync#readme","bugs":{"url":"https://github.com/mayank1513/nextjs-themes/issues"},"dist":{"shasum":"51d0ea869790cfbd8ac33ebe6efbeeddf2e71ac8","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-0.0.1.tgz","fileCount":4,"integrity":"sha512-V+G6jtpgPz/78o35PtA17rvOAWx+eFvdkKE4NRoh1wOalJI4Tmc5iEnuvgxsV5ut8MW8Dep50HzaLvn2wkUujg==","signatures":[{"sig":"MEQCIHwz6GioLBUgrXppygSePRFweCJ7JiMHpcGD0NAhOTKgAiBPxpoRVBO3h3nHarMUwZOuCHldLSTAUNPL4khRHqx+0g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4989},"main":"index.js","types":"index.d.ts","funding":{"url":"https://github.com/sponsors/mayank1513","type":"github"},"gitHead":"69e73449c2a6abee999388d33e91ba5e013bf891","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"repository":{"url":"git+https://github.com/mayank1513/nextjs-themes.git#main","type":"git"},"_npmVersion":"9.5.0","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","directories":{},"sideEffects":false,"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"peerDependencies":{"zustand":"^3 || ^4"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_0.0.1_1692991111060_0.8466251867963643","host":"s3://npm-registry-packages"}},"0.1.0":{"name":"persist-and-sync","version":"0.1.0","keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript"],"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","_id":"persist-and-sync@0.1.0","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"homepage":"https://github.com/mayank1513/nextjs-themes/tree/main/packages/persistnsync#readme","bugs":{"url":"https://github.com/mayank1513/nextjs-themes/issues"},"dist":{"shasum":"dd6005dabf9ce6c024fdb773d4547ecb32b6941e","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-0.1.0.tgz","fileCount":4,"integrity":"sha512-VwOzUj3wqykC3q/eJpRLv1OkxnNwHurl+LjlG0DsS4/KRctwLubhLdH+4PzpOSZ21cwV5hxnDUdCLQzhZycLjg==","signatures":[{"sig":"MEUCIQDDC+h7bJrCNcJqL3j4MLPZq6/lxuccjbR9kD+JE/vCzQIgNf79wdLVCZktz9+pjcHzo9B4g1icYf5DiWsYTZiP0BE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6000},"main":"index.js","types":"index.d.ts","funding":{"url":"https://github.com/sponsors/mayank1513","type":"github"},"gitHead":"0322a2ea3fd26de426fe7f21ae0b483fd061c492","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"repository":{"url":"git+https://github.com/mayank1513/nextjs-themes.git#main","type":"git"},"_npmVersion":"9.6.7","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","directories":{},"sideEffects":false,"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"peerDependencies":{"zustand":"^3 || ^4"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_0.1.0_1693047126423_0.35180117378377007","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"persist-and-sync","version":"0.1.1","keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript"],"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","_id":"persist-and-sync@0.1.1","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"homepage":"https://github.com/mayank1513/persist-and-sync#readme","bugs":{"url":"https://github.com/mayank1513/persist-and-sync/issues"},"dist":{"shasum":"f4e39b412ec58b54dd22c4a5b771ec81c44acc86","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-0.1.1.tgz","fileCount":4,"integrity":"sha512-58DkYZaN8iIQBEqvH4oe/KrHSTTQWFJqBmIRDG52F5xMn/b+AGsXEaH8YW+JGHpmpo7wFJg0ypbLWemeYw7Rug==","signatures":[{"sig":"MEQCIDxXdJt2LLmJR/FGFYeficf9VrIM6lrxaXYuxXfc9/w3AiBOZKpEwayl/tEpbMWpEYd2K33a0fkUZAk2b9aC+wiPZg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7280},"main":"index.js","types":"index.d.ts","funding":{"url":"https://github.com/sponsors/mayank1513","type":"github"},"gitHead":"69ba637a9ea5daf4ea5bd05b7b24ecbafe6d8328","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"repository":{"url":"git+https://github.com/mayank1513/persist-and-sync.git","type":"git"},"_npmVersion":"9.5.0","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","directories":{},"sideEffects":false,"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"peerDependencies":{"zustand":"^3 || ^4"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_0.1.1_1693115415337_0.6758457502017998","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"persist-and-sync","version":"0.1.2","keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript"],"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","_id":"persist-and-sync@0.1.2","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"homepage":"https://github.com/mayank1513/persist-and-sync#readme","bugs":{"url":"https://github.com/mayank1513/persist-and-sync/issues"},"dist":{"shasum":"c33f79e3bb13060453f0356580f1c7539f008abb","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-0.1.2.tgz","fileCount":4,"integrity":"sha512-Jvv5y6ILLHOChedYue9THICSWeQsHkfunIg9SUp/rkraAxZU4PvHvaWZCIXM9Edhv1rcA+5h3yJhAo4e2bbkRQ==","signatures":[{"sig":"MEUCIQCf43IlnEMjGVxeWHHuUUABfUNM/uU8SfRegQSXGuwPVwIgU0SlDIPhyDSaqAbr3aNcHT9618WBcVNT+y/t6Y5Y0VY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8080},"main":"index.js","types":"index.d.ts","funding":{"url":"https://github.com/sponsors/mayank1513","type":"github"},"gitHead":"aaf41afba3c97f87f435388238a08b919ca7a5d4","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"repository":{"url":"git+https://github.com/mayank1513/persist-and-sync.git","type":"git"},"_npmVersion":"9.8.1","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","directories":{},"sideEffects":false,"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"peerDependencies":{"zustand":"^3 || ^4"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_0.1.2_1697299463022_0.302127509644484","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"persist-and-sync","version":"1.0.0","keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript"],"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","_id":"persist-and-sync@1.0.0","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"homepage":"https://github.com/mayank1513/persist-and-sync#readme","bugs":{"url":"https://github.com/mayank1513/persist-and-sync/issues"},"dist":{"shasum":"9541022c7590ff6b76aa7b3ff68090c804110cc4","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-1.0.0.tgz","fileCount":4,"integrity":"sha512-arS5AQ27ugcdu/4UC2yWKAF1oF6LD7Ol0hdTUMQzm5ZpBNhN+W8c2ZTb859ihWnDofGgj+W2iN+NcftGq3EDYQ==","signatures":[{"sig":"MEQCIGG4vERG12fj2c9WaD6O1NKgAqS0CfxcA0j+/7Pf/vnfAiA3xaEVRkLVknVVOQpxCEOZXJoGz8BnzNqdi5rwyZUkaA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11408},"main":"index.js","types":"index.d.ts","funding":{"url":"https://github.com/sponsors/mayank1513","type":"github"},"gitHead":"2c2873433d131d5825bdd3fe58082c66ef3d3efd","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"repository":{"url":"git+https://github.com/mayank1513/persist-and-sync.git","type":"git"},"_npmVersion":"9.8.1","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","_hasShrinkwrap":false,"peerDependencies":{"zustand":"^3 || ^4"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_1.0.0_1700740864226_0.7732550373949283","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"persist-and-sync","version":"1.1.0","keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript"],"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","_id":"persist-and-sync@1.1.0","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"homepage":"https://github.com/mayank1513/persist-and-sync#readme","bugs":{"url":"https://github.com/mayank1513/persist-and-sync/issues"},"dist":{"shasum":"6f29b53bddff7c21225f21c01d287f4befd71dc6","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-1.1.0.tgz","fileCount":4,"integrity":"sha512-5vHY063O9Miuwy5oPydsF6qUBQIdVXityKte5XSEpJfuS8jmSmmMdS12n94zoQkIHZEF/oTg4PXJRohw1n17Gw==","signatures":[{"sig":"MEQCIAD15AmuDqmmvungdLc6mtKMpkayNUR1ZJB6mBT5RG46AiAHJcUaO1aGz7cLPZmsF8yKB67qVzKvQSJLho50IIwIXg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12134},"main":"index.js","types":"index.d.ts","funding":{"url":"https://github.com/sponsors/mayank1513","type":"github"},"gitHead":"00fab3d5b78c087c7eca4739e7de1ade6aab088b","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"repository":{"url":"git+https://github.com/mayank1513/persist-and-sync.git","type":"git"},"_npmVersion":"9.8.1","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","_hasShrinkwrap":false,"peerDependencies":{"zustand":"^3 || ^4"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_1.1.0_1701251623918_0.7135303280089076","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"persist-and-sync","version":"1.1.1","keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript"],"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","_id":"persist-and-sync@1.1.1","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"homepage":"https://github.com/mayank1513/persist-and-sync#readme","bugs":{"url":"https://github.com/mayank1513/persist-and-sync/issues"},"dist":{"shasum":"ccc4d81b65b56beea4a4609783b81b91136c8c4f","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-1.1.1.tgz","fileCount":4,"integrity":"sha512-n+/3m9dILdRNgxEwxPFyRNxAe6ajKK8kNcg3Jiy6iZ+8Q5JhZ7lahqE0oH2uB1WSuy2vZPf2go/HLOjDnkCD7w==","signatures":[{"sig":"MEUCIQC7AVRIXx7CrDGvhDFmbh53REJ4nX9YFAHMOriDPlEK7wIgGViSUzxg1BJ7TsLTMnxXKHljyVKYwWJfe5jq2PDLs/k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11976},"main":"index.js","types":"index.d.ts","funding":{"url":"https://github.com/sponsors/mayank1513","type":"github"},"gitHead":"afe30a1b5d18965686277e4eb39db33fdc3f1c86","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"repository":{"url":"git+https://github.com/mayank1513/persist-and-sync.git","type":"git"},"_npmVersion":"9.8.1","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","_hasShrinkwrap":false,"devDependencies":{"jsdom":"^23.0.1","vitest":"^0.34.6","octokit":"^3.1.2","zustand":"^4.4.7","typescript":"^5.3.2","@types/node":"^20.10.2","@vitest/coverage-v8":"^0.34.6","@vitejs/plugin-react":"^4.2.0","@testing-library/react":"^14.1.2"},"peerDependencies":{"zustand":"^3 || ^4"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_1.1.1_1701543294826_0.7369541517147657","host":"s3://npm-registry-packages"}},"1.1.2":{"name":"persist-and-sync","version":"1.1.2","keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript"],"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","_id":"persist-and-sync@1.1.2","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"homepage":"https://github.com/react18-tools/persist-and-sync#readme","bugs":{"url":"https://github.com/react18-tools/persist-and-sync/issues"},"dist":{"shasum":"fd56524bcc66cd915a2503b95b0ae4c56348a4be","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-1.1.2.tgz","fileCount":4,"integrity":"sha512-8BU6f2Q7w9KvP9T2GM/1ZaCWGWOGB3qsDS0vXErD8hhICJR8cV5xaaSEiqW1ZSeFv65H4EalfMHueNXf2DJZwg==","signatures":[{"sig":"MEUCIQCOnP4v/84wOB3LvSxXz2k1AqbHwqt1GXg7zHZ9Yo4PhwIgDJ8NyUIM1gvI4aHFD8EsTey6XE9G+pTF4z3r1YMSiLo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11758},"main":"index.js","types":"index.d.ts","funding":{"url":"https://github.com/sponsors/mayank1513","type":"github"},"gitHead":"d1caed860c192e2615b7a521451ef94c0141d3dc","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"repository":{"url":"git+https://github.com/react18-tools/persist-and-sync.git","type":"git"},"_npmVersion":"10.2.3","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","_hasShrinkwrap":false,"devDependencies":{"jsdom":"^23.0.1","vitest":"^1.1.0","octokit":"^3.1.2","zustand":"^4.4.7","typescript":"^5.3.3","@types/node":"^20.10.5","@vitest/coverage-v8":"^1.1.0","@vitejs/plugin-react":"^4.2.1","@testing-library/react":"^14.1.2"},"peerDependencies":{"zustand":"^3 || ^4"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_1.1.2_1703838044707_0.9561259562074642","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"persist-and-sync","version":"1.2.0","keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript"],"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","_id":"persist-and-sync@1.2.0","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"homepage":"https://github.com/react18-tools/persist-and-sync#readme","bugs":{"url":"https://github.com/react18-tools/persist-and-sync/issues"},"dist":{"shasum":"972a0e9cbc28c6c5d766b3544c685bb7249ce7f0","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-1.2.0.tgz","fileCount":4,"integrity":"sha512-hApzP8QYJ56KiLUi+Y1YfYH7vP00o1cru1x/GudhFT9k5U+w98XDfSwI9G9rJ2WmeNXpnGMmn8wCWxnT2rB0Wg==","signatures":[{"sig":"MEQCICRYR4169tpSxewMKd393p7NvxD9uPHGltctaDOvexgWAiByeorAWjsB1OeFlF5hzPqqFTaHyUSjPkAuRRdpW+vFLQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14616},"main":"index.js","types":"index.d.ts","funding":{"url":"https://github.com/sponsors/mayank1513","type":"github"},"gitHead":"04de9a9acaf7904e105f278b351f3f6f2442f33e","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"repository":{"url":"git+https://github.com/react18-tools/persist-and-sync.git","type":"git"},"_npmVersion":"10.2.3","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","_hasShrinkwrap":false,"devDependencies":{"jsdom":"^23.0.1","vitest":"^1.1.0","octokit":"^3.1.2","zustand":"^4.4.7","typescript":"^5.3.3","@types/node":"^20.10.6","@vitest/coverage-v8":"^1.1.0","@vitejs/plugin-react":"^4.2.1","@testing-library/react":"^14.1.2"},"peerDependencies":{"zustand":"^3 || ^4"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_1.2.0_1703915318372_0.6216737008911468","host":"s3://npm-registry-packages"}},"1.2.1":{"name":"persist-and-sync","version":"1.2.1","keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript"],"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","_id":"persist-and-sync@1.2.1","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"homepage":"https://github.com/react18-tools/persist-and-sync#readme","bugs":{"url":"https://github.com/react18-tools/persist-and-sync/issues"},"dist":{"shasum":"83a75de1156e0efa7351103c33819ee4c33191c2","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-1.2.1.tgz","fileCount":4,"integrity":"sha512-McPXNsMKYnMJGFuAEy//EezrKFuI1sq4TjcSNKbDegkA0mG1RzgVcRzI1qyFgPC+Qao8eHlH65Ck7Awp9u2dUg==","signatures":[{"sig":"MEUCIGmB747eVYZOXRHLHXn0ruPa8QjVsCUvlYPi6OO2VuT5AiEAlRvZ2XfQcaRPHTr0H97wmY72TswaQScMQw18L3USCRs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14616},"main":"index.js","types":"index.d.ts","funding":{"url":"https://github.com/sponsors/mayank1513","type":"github"},"gitHead":"19d4dad6058c29a493fb6916cd79c94dd4bb1b7e","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"repository":{"url":"git+https://github.com/react18-tools/persist-and-sync.git","type":"git"},"_npmVersion":"10.2.3","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","_hasShrinkwrap":false,"devDependencies":{"jsdom":"^23.0.1","vitest":"^1.1.0","octokit":"^3.1.2","zustand":"^4.4.7","typescript":"^5.3.3","@types/node":"^20.10.6","@vitest/coverage-v8":"^1.1.0","@vitejs/plugin-react":"^4.2.1","@testing-library/react":"^14.1.2"},"peerDependencies":{"zustand":"^3 || ^4"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_1.2.1_1704164860799_0.768151271244901","host":"s3://npm-registry-packages"}},"1.2.2":{"name":"persist-and-sync","version":"1.2.2","keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript","mayank1513"],"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","_id":"persist-and-sync@1.2.2","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"homepage":"https://github.com/react18-tools/persist-and-sync#readme","bugs":{"url":"https://github.com/react18-tools/persist-and-sync/issues"},"dist":{"shasum":"c17013029b764a9b9fe0510d27c9dcce4df7cab2","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-1.2.2.tgz","fileCount":4,"integrity":"sha512-rrljeU8rNW1TRGLWCr0tSXRNlPJd2pkcQBeKugosKhnQRq7fhI51f+4UvnGEIuEziAqE1LLdezmccbzTW54kvw==","signatures":[{"sig":"MEUCIGFS1rertlXvdkziekcS8MyDA5XLhFmo4nkACr4c5CzTAiEAiff3dHrSAi8Rb+R4V9rKiL1BbMpzwK7EOPyutpmuMJE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14608},"main":"index.js","types":"index.d.ts","funding":{"url":"https://github.com/sponsors/mayank1513","type":"github"},"gitHead":"4e8924af983a63f3a23859a347a39ff38118b49d","_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"repository":{"url":"git+https://github.com/react18-tools/persist-and-sync.git","type":"git"},"_npmVersion":"10.8.2","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","directories":{},"sideEffects":false,"_nodeVersion":"20.18.2","_hasShrinkwrap":false,"devDependencies":{"jsdom":"^23.0.1","vitest":"^1.1.0","octokit":"^3.1.2","zustand":"^4.4.7","typescript":"^5.3.3","@types/node":"^20.10.6","@vitest/coverage-v8":"^1.1.0","@vitejs/plugin-react":"^4.2.1","@testing-library/react":"^14.1.2"},"peerDependencies":{"zustand":">=3"},"_npmOperationalInternal":{"tmp":"tmp/persist-and-sync_1.2.2_1739340873203_0.735836997838494","host":"s3://npm-registry-packages-npm-production"}},"1.2.3":{"name":"persist-and-sync","author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"version":"1.2.3","description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","main":"index.js","types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/react18-tools/persist-and-sync.git"},"bugs":{"url":"https://github.com/react18-tools/persist-and-sync/issues"},"homepage":"https://github.com/react18-tools/persist-and-sync#readme","sideEffects":false,"license":"MIT","funding":{"type":"github","url":"https://github.com/sponsors/mayank1513"},"devDependencies":{"@testing-library/react":"^16.3.0","@types/node":"^22.15.21","@vitejs/plugin-react":"^4.4.1","@vitest/coverage-v8":"^3.1.4","jsdom":"^26.1.0","octokit":"^5.0.2","typescript":"^5.8.3","vitest":"^3.1.4","zustand":"^5.0.5"},"peerDependencies":{"zustand":">=3"},"keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript","mayank1513"],"_id":"persist-and-sync@1.2.3","gitHead":"468ef9b8af116ad34a9eb2fe1fb460256730f426","_nodeVersion":"20.19.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-narBnOLMCSNbQ8Jw0uElpl78ALkPNFvDiz0tUV/7JM/q90E9dntblDYz9mgEO8F9JT/S5pU7B7jltEDDdidbBw==","shasum":"9a9a254f05f13dce3298cb880bae4772e10f9737","tarball":"https://registry.npmjs.org/persist-and-sync/-/persist-and-sync-1.2.3.tgz","fileCount":4,"unpackedSize":14702,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFUJEBHqir7XUUZ7wMwpj0rYz4K4Py+vFOf6l2ci4ou0AiAcZ4HN5hokDHmMirgnIzJjiCFd400o0IZpWCdICVa2UQ=="}]},"_npmUser":{"name":"mayank1513","email":"mayank.srmu@gmail.com"},"directories":{},"maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/persist-and-sync_1.2.3_1747990275258_0.33363554875885315"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-25T18:51:15.131Z","modified":"2025-05-23T08:51:15.630Z","0.0.0":"2023-08-25T18:51:15.318Z","0.0.1":"2023-08-25T19:18:31.255Z","0.1.0":"2023-08-26T10:52:06.563Z","0.1.1":"2023-08-27T05:50:15.502Z","0.1.2":"2023-10-14T16:04:23.208Z","1.0.0":"2023-11-23T12:01:04.453Z","1.1.0":"2023-11-29T09:53:44.066Z","1.1.1":"2023-12-02T18:54:54.984Z","1.1.2":"2023-12-29T08:20:44.856Z","1.2.0":"2023-12-30T05:48:38.559Z","1.2.1":"2024-01-02T03:07:41.048Z","1.2.2":"2025-02-12T06:14:33.375Z","1.2.3":"2025-05-23T08:51:15.450Z"},"bugs":{"url":"https://github.com/react18-tools/persist-and-sync/issues"},"author":{"name":"Mayank Kumar Chaudhari","email":"https://mayank-chaudhari.vercel.app"},"license":"MIT","homepage":"https://github.com/react18-tools/persist-and-sync#readme","keywords":["web","api","broadcast","channel","sync-tabs","sync-windows","sync","broadcast-channel","persist","localStorage","hooks","react","react 18","zustand","middleware","state","optimized","tiny","typescript","javascript","mayank1513"],"repository":{"type":"git","url":"git+https://github.com/react18-tools/persist-and-sync.git"},"description":"Zustand middleware to easily persist and sync Zustand state between tabs and windows","maintainers":[{"name":"mayank1513","email":"mayank.srmu@gmail.com"}],"readme":"# Persist-And-Sync Zustand Store\n\n[![test](https://github.com/react18-tools/persist-and-sync/actions/workflows/test.yml/badge.svg)](https://github.com/react18-tools/persist-and-sync/actions/workflows/test.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/5355eb02cfedc9184e3f/maintainability)](https://codeclimate.com/github/mayank1513/persist-and-sync/maintainability) [![codecov](https://codecov.io/gh/mayank1513/persist-and-sync/graph/badge.svg)](https://codecov.io/gh/mayank1513/persist-and-sync) [![Version](https://img.shields.io/npm/v/persist-and-sync.svg?colorB=green)](https://www.npmjs.com/package/persist-and-sync) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/persist-and-sync.svg)](https://www.npmjs.com/package/persist-and-sync) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/persist-and-sync)\n\n> Zustand middleware to easily persist and sync Zustand state between tabs/windows/iframes (Same Origin)\n\n> Motivation: Recently I got caught up in several issues working with the persist middleware and syncing tabs with Zustand. This is a simple lightweight middleware to persist and instantly share state between tabs or windows\n\n- ✅ 🐙 ~ 1 kB size cross-tab state sharing + persistence for zustand\n- ✅ Full TypeScript Support\n- ✅ solid reliability in 1 writing and n reading tab scenarios (with changing writing tab)\n- ✅ Fire and forget approach of always using the latest state. Perfect for single-user systems\n- ✅ Share state between multiple browsing contexts\n- ✅ Additional control over which fields to `persist-and-sync` and which to ignore\n- ✅ Optimized for performance using memoization and closures.\n- ✅ Update options at runtime by setting `__persistNSyncOptions` in your store.\n\n## Install\n\n```bash\n$ pnpm add persist-and-sync\n```\n\n**or**\n\n```bash\n$ npm install persist-and-sync\n```\n\n**or**\n\n```bash\n$ yarn add persist-and-sync\n```\n\n## Usage\n\nAdd the middleware while creating the store and the rest will be taken care.\n\n```ts\nimport { create } from \"zustand\";\nimport { persistNSync } from \"persist-and-sync\";\n\ntype MyStore = {\n\tcount: number;\n\tset: (n: number) => void;\n};\n\nconst useStore = create<MyStore>(\n\tpersistNSync(\n\t\tset => ({\n\t\t\tcount: 0,\n\t\t\tset: n => set({ count: n }),\n\t\t}),\n\t\t{ name: \"my-example\" },\n\t),\n);\n```\n\n⚡🎉Boom! Just a couple of lines and your state perfectly syncs between tabs/windows and it is also persisted using `localStorage`!\n\n## Advanced Usage (Customizations)\n\n### PersistNSyncOptions\n\nIn several cases, you might want to exclude several fields from syncing. To support this scenario, we provide a mechanism to exclude fields based on a list of fields or regular expressions.\n\n```typescript\ntype PersistNSyncOptionsType = {\n\tname: string;\n\t/** @deprecated */\n\tregExpToIgnore?: RegExp;\n\tinclude?: (string | RegExp)[];\n\texclude?: (string | RegExp)[];\n\tstorage?: \"localStorage\" | \"sessionStorage\" | \"cookies\" /** Added in v1.1.0 */;\n};\n```\n\n**Example**\n\n```typescript\nexport const useMyStore = create<MyStoreType>()(\n\tpersistNSync(\n\t\tset => ({\n\t\t\tcount: 0,\n\t\t\t_count: 0 /** skipped as it is included in exclude array */,\n\t\t\tsetCount: count => {\n\t\t\t\tset(state => ({ ...state, count }));\n\t\t\t},\n\t\t\tset_Count: _count => {\n\t\t\t\tset(state => ({ ...state, _count }));\n\t\t\t},\n\t\t}),\n\t\t{ name: \"example\", exclude: [\"_count\"] },\n\t),\n);\n```\n\n> It is good to note here that each element of `include` and `exclude` array can either be a string or a regular expression.\n> To use regular expression, you should either use `new RegExp()` or `/your-expression/` syntax. Double or single quoted strings are not treated as regular expression.\n> You can specify whether to use either `\"localStorage\"`, `\"sessionStorage\"`, or `\"cookies\"` to persist the state - default `\"localStorage\"`. Please note that `\"sessionStorage\"` is not persisted. Hence can be used for sync only scenarios.\n\n### Updating options at runtime\n\nSince version 1.2, you can also update the options at runTime by setting `__persistNSyncOptions` in your Zustand state.\n\n**Example**\n\n```ts\ninterface StoreWithOptions {\n\tcount: number;\n\t_count: number;\n\t__persistNSyncOptions: PersistNSyncOptionsType;\n\tsetCount: (c: number) => void;\n\tset_Count: (c: number) => void;\n\tsetOptions: (__persistNSyncOptions: PersistNSyncOptionsType) => void;\n}\n\nconst defaultOptions = { name: \"example\", include: [/count/], exclude: [/^_/] };\n\nexport const useStoreWithOptions = create<StoreWithOptions>(\n\tpersistNSync(\n\t\tset => ({\n\t\t\tcount: 0,\n\t\t\t_count: 0 /** skipped as it matches the regexp provided */,\n\t\t\t__persistNSyncOptions: defaultOptions,\n\t\t\tsetCount: count => set(state => ({ ...state, count })),\n\t\t\tset_Count: _count => set(state => ({ ...state, _count })),\n\t\t\tsetOptions: __persistNSyncOptions => set(state => ({ ...state, __persistNSyncOptions })),\n\t\t}),\n\t\tdefaultOptions,\n\t),\n);\n```\n\n### Clear Storage\n\nStarting from version 1.2, you can also clear the persisted data by calling `clearStorage` function. It takes `name` of your store (`name` passed in `options` while creating the store), and optional `storageType` parameters.   \n\n```ts\nimport { clearStorage } from \"persist-and-sync\";\n\n...\n\tclearStorage(\"my-store\", \"cookies\");\n...\n```\n\n## Legacy / Deprecated\n\n#### Ignore/filter out fields based on regExp\n\nIn several cases, you might want to exclude several fields from syncing. To support this scenario, we provide a mechanism to exclude fields based on regExp. Just pass `regExpToIgnore` (optional - default -> undefined) in the options object.\n\n```ts\n// to ignore fields containing a slug\npersistNSync(\n    set => ({\n      count: 0,\n      slugSomeState: 1,\n      slugSomeState2: 1,\n      set: n => set({ count: n }),\n    }),\n    { name: \"my-channel\", regExpToIgnore: /slug/ },\n    // or regExpToIgnore: new RegExp('slug')\n    // Use full power of regExp by adding `i` and `g` flags\n  ),\n```\n\nFor more details about regExp check out - [JS RegExp](https://www.w3schools.com/jsref/jsref_obj_regexp.asp)\n\n### Exact match\n\nFor exactly matching a parameter/field use `/^your-field-name$/`. `^` forces match from the first character and similarly, `$` forces match until the last character.\n\n### Ignore multiple fields with exact match\n\nuse `regExpToIgnore: /^(field1|field2|field3)$/`\n\n### 🤩 Don't forget to star [this repo](https://github.com/mayank1513/persist-and-sync)!\n\nWant a hands-on course for getting started with Turborepo? Check out [React and Next.js with TypeScript](https://mayank-chaudhari.vercel.app/courses/react-and-next-js-with-typescript) and [The Game of Chess with Next.js, React and TypeScrypt](https://www.udemy.com/course/game-of-chess-with-nextjs-react-and-typescrypt/?referralCode=851A28F10B254A8523FE)\n\n## License\n\nLicensed as MIT open source.\n\n<hr />\n\n<p align=\"center\" style=\"text-align:center\">with 💖 by <a href=\"https://mayank-chaudhari.vercel.app\" target=\"_blank\">Mayank Kumar Chaudhari</a></p>\n","readmeFilename":"README.md"}