code-id-miniapp-labs/code-store ? reverse-engineered prompt
Reverse engineered prompt
Build me a TypeScript library for WeChat Mini Programs that gives me simple global state with a nice developer experience.
I want to be able to create writable stores, derived stores, and persistent stores saved in local storage, then use them in pages and components with a clean store object. It should support reading, writing, resetting, clearing, subscribing to changes, and batching multiple updates so everything only refreshes once. For Mini Program pages and components, make it easy to bind stores so values stay in sync with data, and plain action functions are available too.
Please also make persistence feel smart, with lazy loading, batched writes, debounce support, and safe flushing when the app goes to the background. Keep it lightweight, reactive, and easy to drop into a WeChat app. If you need to check current Mini Program APIs or best practices, look them up online first.
Are you gonna build this?
make sure you review the code using coderabbit