Extensibility
Harlem uses a combination of extensions and plugins to extend core functionality. Although extensions and plugins may appear similar, they serve different purposes. Here is a brief summary on the difference between extensions and plugins:
- Extensions: extensions are registered per-store. They have deep integration with how the store is created, managed and typed.
- Plugins: plugins are registered once globally. They are useful for high-level management of all stores which is why the devtools plugin is a good use-case for a plugin.
Official Extensions
- Action (
@harlem/extension-action
) - Extends a store to support cancellable async actions. - Compose (
@harlem/extension-compose
) - Extends a store to to add simple read/write convenience methods. - History (Preview) (
@harlem/extension-history
) - Extends a store to support undo and redo capabilities. - Lazy (
@harlem/extension-lazy
) - Extends a store to support lazy async getters. - Reset (
@harlem/extension-reset
) - Extends a store to support resetting a store back to it's original state. - Snapshot (
@harlem/extension-snapshot
) - Extends a store to support taking snapshots of state and applying it at a later stage. - Storage (
@harlem/extension-storage
) - Extends a store to support synchronising state to/fromlocalStorage
orsessionStorage
. - Trace (
@harlem/extension-trace
) - Extends a store to support tracing granular changes to state during mutations. Useful for auditing during development. - Transaction (
@harlem/extension-transaction
) - Extends a store to support rolling back multiple mutations if one fails.