一个用于管理撤销栈的小工具
A small utility for managing an undo stack, that you can subscribe to in your Svelte applications (or indeed anywhere else).
…In a Svelte component, you can reference first and last as store properties without manually subscribing:
value = stack.undo()}>Undo
value = stack.redo()}>RedoYou can also access the current value of the stack, if that's preferable to tracking the value manually:
The answer is {$stack.current.answer}
Don't mutate the objects you push to the undo stack; chaos will result. Instead, create a fresh copy each time, either manually or using something like Immer.
MIT
暂无开放 Issues,或尚未同步最近议题。