{"id":21043063,"url":"https://github.com/mrinalxdev/zeno-store","last_synced_at":"2025-09-09T06:53:03.467Z","repository":{"id":212981154,"uuid":"732745376","full_name":"mrinalxdev/zeno-store","owner":"mrinalxdev","description":"it is a powerful npm package designed for complex state management , it simplifies state handling for efficient and scalable web apps","archived":false,"fork":false,"pushed_at":"2023-12-18T21:53:16.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-21T00:49:23.723Z","etag":null,"topics":["javascript-library","node-module","node-package","node-package-manager"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrinalxdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-17T17:35:58.000Z","updated_at":"2023-12-19T07:11:12.000Z","dependencies_parsed_at":"2023-12-17T18:47:51.225Z","dependency_job_id":null,"html_url":"https://github.com/mrinalxdev/zeno-store","commit_stats":null,"previous_names":["mrinalxdev/zeno-store"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrinalxdev%2Fzeno-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrinalxdev%2Fzeno-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrinalxdev%2Fzeno-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrinalxdev%2Fzeno-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrinalxdev","download_url":"https://codeload.github.com/mrinalxdev/zeno-store/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243489812,"owners_count":20298997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript-library","node-module","node-package","node-package-manager"],"created_at":"2024-11-19T14:10:48.311Z","updated_at":"2025-03-13T21:43:58.175Z","avatar_url":"https://github.com/mrinalxdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZenStore NPM Package \n\u003e This manages complex state management in a web app\n\nZenStore NPM package is powerful state management solution designed to simplify complex state management in web applications. With a rich set of features, it provides developers with the tools needed to efficiently handle state in a scalable and maintainable way. \n\n## Features and usecase for the package .\n\n### 1 . Middleware Support \n\n```js\nconst {Zenstore} = require('zen-store')\n\n//Creating an instance\nconst zenStore = new ZenStore()\n\n//Middleware Support\nconst middleare = (prevState, nextState) =\u003e {\n    console.log('Middleware : State updated ', nextState)\n}\nzenStore.applyMiddleware(middleware)\n```\nZenStore offers middleware support, allowing developers to inject custom logic into the state update process. This is particularly useful for tasks like logging, asynchronous operations, and third-party integrations.\n\n### 2. Presistence Middleware\n\n```js\nconst {PresistenceMiddleware} = require('zen-store')\n\nconst persistenceMiddleware = new PersistenceMiddleware('zen-store-state.json');\nzenStore.applyMiddleware(persistenceMiddleware.persistState);\n```\n\nThe package includes a Persistence Middleware, enabling seamless storage and retrieval of application state. This ensures that the state can persist across page reloads, improving the overall user experience.\n\n### 3. Event Listeners and Custom Event Triggers \n\n```js\n// Event Listeners\n\nzenStore.on('userLoggedIn', user =\u003e {\n  console.log(`Event Listener: User logged in - ${user.username}`);\n});\n\n//unsubscribing listeners\nconst listener = state =\u003e {\n  console.log('Listener: State Updated', state);\n};\n\nconst unsubscribe = zenStore.subscribe(listener);\nsetTimeout(unsubscribe, 5000) // to unsubsribe after some time\n\n// Custom Event Trigger\nzenStore.triggerEvent('userLoggedIn', { username: 'JohnDoe' });\n\n```\nDevelopers can subscribe to state changes using event listeners, facilitating responsive UI updates. Additionally, ZenStore allows the triggering of custom events, enhancing flexibility in handling various application events.\n\n### 4. Undo/Redo Functionality\n\n```js\nzenStore.setState({ count: 44 });\nzenStore.undo();\n```\nZenStore introduces undo and redo functionality, enabling users to navigate through previous states. This is particularly beneficial in scenarios where users need to revert to a specific application state.\n\n### 5. Debounce State Updates and Batch Update Configuration\n\n```js\n// Debounce State Updates\nzenStore.setDebounceDelay(500);\nzenStore.setState({ count: 45 }, true, true);\n\n// Batch Update Config.\nzenStore.startBatchUpdate();\nzenStore.queueBatchUpdate({ count: 46 });\nzenStore.endBatchUpdate();\n```\nThe package includes features for controlling the frequency of state updates, offering debouncing options and batch update configurations. This ensures that state updates are optimized for performance.\n\n### 6. Deep State Comparison\n\n```js\nzenStore.enableDeepStateComparison();\nzenStore.setState({ nested: { prop: 'value' } });\nzenStore.setState({ nested: { prop: 'updatedValue' } });\n```\n\nZenStore supports deep state comparison, providing developers with granular control over state changes. This feature is valuable in scenarios where precise tracking of changes is crucial.\n\n## Some Bonus Documentation of the features enhancements\n\n```js\n// Persistent State Storage Configuration\nzenStore.setLocalStorageKey('custom-key');\nzenStore.persistStateToLocalStorage();\n\n// More Optimal Error Handling\nzenStore.setErrorHandler(error =\u003e {\n  console.error('Custom Error Handler:', error);\n});\n\n// Versioning\npersistenceMiddleware.incrementVersion();\n\n// Additional features from PersistenceMiddleware\npersistenceMiddleware.saveState({ additionalData: 'Persisted Data' });\nconst loadedState = persistenceMiddleware.loadState();\nconsole.log('Loaded State:', loadedState);\n\nconst fileInfo = persistenceMiddleware.getFileInfo();\nconsole.log('File Information:', fileInfo);\n\npersistenceMiddleware.renameFile('new-zen-store-state.json');\npersistenceMiddleware.deleteFile();\n\nconsole.log('Package features demonstration completed.');\n\n```\n\n\n## Upcoming Features\n\n- Error Handling Enhancements\n- Advanced Persistence Options\n- Integration with Frameworks\n\nStay tuned for these exciting additions to the ZenStore package, as we continue to evolve and enhance the state management experience for web developers.``","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrinalxdev%2Fzeno-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrinalxdev%2Fzeno-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrinalxdev%2Fzeno-store/lists"}