{"_id":"e-boxes","_rev":"1-2000be02939b1b6d3d517763964ee43a","name":"e-boxes","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"e-boxes","version":"0.0.1","author":{"name":"tingxi8087"},"license":"MIT","_id":"e-boxes@0.0.1","maintainers":[{"name":"tingxi8087","email":"1099054520@qq.com"}],"homepage":"https://github.com/tingxi8087/e-box","bugs":{"url":"https://github.com/tingxi8087/e-box/issues"},"dist":{"shasum":"f831c7ee455d5dc195bbd613243d62ed4b889d8b","tarball":"https://registry.npmjs.org/e-boxes/-/e-boxes-0.0.1.tgz","fileCount":7,"integrity":"sha512-plaGLrzCmI/Y7SkIMOSV4c5rrT/WGRzK5AG0i4FyDPykLksCjt6mvMyD3vJ5z8bK1iQg5VnVLiguGXBANyMqiw==","signatures":[{"sig":"MEUCIH0G+nVvSfwdwwnVxxZwbgXMQ3kx7TxEY6j0XBeS2NOAAiEApxBRI9lg4wKDFxfT+rYfQlGzi7SNoMsedGNjhCDypUU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13010},"main":"dist/index.min.js","type":"module","module":"dist/index.es.js","gitHead":"8e0644325629593b9be9568ac8fb8e048e64ee36","private":false,"scripts":{"dev":"vite","sync":"npm publish && cnpm sync e-box && explorer \"https://npmmirror.com/package/e-box\"","build":"vite build --config vite.config.build.ts","start":"npm run dev","build:min":"terser dist/index.umd.js -o dist/index.min.js -c -m"},"typings":"dist/index.d.ts","_npmUser":{"name":"tingxi8087","email":"1099054520@qq.com"},"repository":{"url":"git+ssh://git@github.com/tingxi8087/e-box.git","type":"git"},"_npmVersion":"10.8.2","description":"一个关于React的超级简单的全局状态管理器","directories":{},"_nodeVersion":"18.20.5","dependencies":{"use-sync-external-store":"^1.4.0","@types/use-sync-external-store":"^0.0.6"},"_hasShrinkwrap":false,"devDependencies":{"antd":"^5.6.0","less":"^4.1.3","vite":"^4.3.9","axios":"^1.4.0","react":"^18.2.0","resso":"^0.14.0","eslint":"^8.38.0","react-dom":"^18.2.0","typescript":"^5.0.2","@types/node":"^20.3.1","mas-encrypt":"^1.0.2","@types/react":"^18.0.37","vite-plugin-dts":"^4.3.0","@types/react-dom":"^18.0.11","react-router-dom":"^6.11.2","@ant-design/icons":"^5.2.6","@babel/preset-env":"^7.26.0","@vitejs/plugin-react-swc":"^3.0.0","@typescript-eslint/parser":"^5.59.0","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-refresh":"^0.3.4","@types/use-sync-external-store":"^0.0.6","@typescript-eslint/eslint-plugin":"^5.59.0"},"_npmOperationalInternal":{"tmp":"tmp/e-boxes_0.0.1_1734244118394_0.10216078351433677","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"e-boxes","private":false,"version":"0.0.2","type":"module","main":"dist/index.min.js","module":"dist/index.es.js","typings":"dist/index.d.ts","author":{"name":"tingxi8087"},"license":"MIT","keywords":["redux","react"],"repository":{"type":"git","url":"git+ssh://git@github.com/tingxi8087/e-boxes.git"},"homepage":"https://github.com/tingxi8087/e-boxes","scripts":{"dev":"vite","start":"npm run dev","build":"vite build --config vite.config.build.ts","build:min":"terser dist/index.umd.js -o dist/index.min.js -c -m","sync":"npm publish && cnpm sync e-boxes && explorer \"https://npmmirror.com/package/e-boxes\""},"dependencies":{"@types/use-sync-external-store":"^0.0.6","use-sync-external-store":"^1.4.0"},"devDependencies":{"@ant-design/icons":"^5.2.6","@babel/preset-env":"^7.26.0","@types/node":"^20.3.1","@types/react":"^18.0.37","@types/react-dom":"^18.0.11","@types/use-sync-external-store":"^0.0.6","@typescript-eslint/eslint-plugin":"^5.59.0","@typescript-eslint/parser":"^5.59.0","@vitejs/plugin-react-swc":"^3.0.0","antd":"^5.6.0","axios":"^1.4.0","eslint":"^8.38.0","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-refresh":"^0.3.4","less":"^4.1.3","mas-encrypt":"^1.0.2","react":"^18.2.0","react-dom":"^18.2.0","react-router-dom":"^6.11.2","resso":"^0.14.0","typescript":"^5.0.2","vite":"^4.3.9","vite-plugin-dts":"^4.3.0"},"_id":"e-boxes@0.0.2","gitHead":"3cd60dff7ba48b98fcf98ca33580399696d00eab","description":"一个关于React的超级简单的全局状态管理器","bugs":{"url":"https://github.com/tingxi8087/e-boxes/issues"},"_nodeVersion":"18.20.5","_npmVersion":"10.8.2","dist":{"integrity":"sha512-ma03aNN8G7jN1rjyfzBPVtt46xPaxgPOVbLVkYknv6BOG3taCmRvskccUrcnPlfUtUv5OvV6zEpqnMhIvoHaTg==","shasum":"7fac52f11763265e1478ad55553858aa1a3b7ba6","tarball":"https://registry.npmjs.org/e-boxes/-/e-boxes-0.0.2.tgz","fileCount":7,"unpackedSize":13064,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEDwKU7Dz68nNNfTbafUf/pZw3xbwudqa8HENNOMtyJlAiBs63mA+fr7FpfnclZ9C3dTCBvUhW26fOk+PvvauUvBUw=="}]},"_npmUser":{"name":"tingxi8087","email":"1099054520@qq.com"},"directories":{},"maintainers":[{"name":"tingxi8087","email":"1099054520@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/e-boxes_0.0.2_1734244414054_0.21833920330959966"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-15T06:28:38.309Z","modified":"2024-12-15T06:33:34.438Z","0.0.1":"2024-12-15T06:28:38.592Z","0.0.2":"2024-12-15T06:33:34.250Z"},"bugs":{"url":"https://github.com/tingxi8087/e-boxes/issues"},"author":{"name":"tingxi8087"},"license":"MIT","homepage":"https://github.com/tingxi8087/e-boxes","repository":{"type":"git","url":"git+ssh://git@github.com/tingxi8087/e-boxes.git"},"description":"一个关于React的超级简单的全局状态管理器","maintainers":[{"name":"tingxi8087","email":"1099054520@qq.com"}],"readme":"# e-boxes\r\n\r\n一个关于React的超级简单的全局状态管理器\r\n\r\n参考自 [nanxiaobei/resso](https://github.com/nanxiaobei/resso)\r\n\r\n安装\r\n\r\n```sh\r\ncnpm i e-boxes\r\n# or\r\nyarn add e-boxes\r\n# or\r\nnpm i e-boxes\r\n```\r\n\r\n## 使用\r\n\r\n### 在React中使用\r\n\r\n// store.js\r\n\r\n```javascript\r\nimport eBox from \"e-boxes\";\r\n\r\nexport const store = eBox({\r\n  count: 0,\r\n  name: \"张三\",\r\n  addCount() {\r\n    store.count += 1;\r\n  },\r\n});\r\nexport const getCountByFunc = () => {\r\n  // console.log(store.count); //这行代码可能会引起报错\r\n  // 不在UI中使用，且方法为挂载到store上，请通过store.$ 获取值 ,更新状态值与在UI中保持一致\r\n  console.log(store.$.count);\r\n};\r\n```\r\n\r\n// App.js\r\n\r\n```javascript\r\nimport { store } from \"./store\";\r\nexport default function App() {\r\n  const { count, name，addCount } = store; // UI中展示状态必须在顶层解构\r\n  return (\r\n    <>\r\n      <div>{name}</div>\r\n      <div>{count}</div>\r\n      <button\r\n        onClick={() => {\r\n          // 直接操作值添加\r\n          store.count += 2;\r\n\r\n          // 通过方法添加\r\n          // addCount();\r\n\r\n          // 打印出修改后的值\r\n          console.log(store.count);\r\n        }}\r\n      >\r\n        add\r\n      </button>\r\n      <br />\r\n      <button\r\n        onClick={() => {\r\n          // 批量更新\r\n          store.set({\r\n            name: \"李四\",\r\n            count: 99,\r\n          });\r\n        }}\r\n      >\r\n        批量更新值\r\n      </button>\r\n    </>\r\n  );\r\n}\r\n```\r\n\r\n## 预置对象\r\n\r\n| name | 描述 | 示例 |\r\n|----|----|----|\r\n| get | 调用函数获取值，与$返回的对象一致 | store.get() |\r\n| set | 批量更新值 | store.set({xxx:xxx}) |\r\n| $ | 用于 | store.$ |\r\n\r\n\r\n","readmeFilename":"README.md","keywords":["redux","react"]}