-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: further extensive docs changes
- Loading branch information
1 parent
4632979
commit 2448b94
Showing
25 changed files
with
354 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
# Harlem | ||
# Harlem | ||
|
||
## Foundations | ||
|
||
### Simple | ||
Harlem has a simple functional API for creating, reading and mutating state. At it's heart, Harlem just uses Vue reactive objects and computeds which means if you know how to use Vue, you'll know how to use Harlem. | ||
|
||
### Unopinionated | ||
Harlem doesn't impose any standards or conventions on your codebase. Because of it's simple functional API you can structure your code anyway you want and Harlem will just work. | ||
|
||
### Immutable | ||
All state provided from a Harlem store is immutable by default. The only write access to state is through mutations. This ensures all updates to your store are tracable, thereby reducing the amount of bugs produced by code unpredictably mutating state. | ||
|
||
### Lightweight | ||
Harlem core weighs in at around 1.5KB (minified & gzipped) which makes it the perfect solution for codebases of all sizes. It is also designed to be tree-shakable - unused stores, getters, or mutations will be removed from your code at build time (provided you are using a build tool that supports tree-shaking). | ||
|
||
It's also worth noting that Harlem has **zero** dependencies. | ||
|
||
### Extensible | ||
Harlem is architectured with extensibility in mind so you can extend it any way you want through [plugins](#plugins) and [extensions](#extensions). Some of the official plugins and extensions include Vue devtools integration, local/session storage sync, snapshots, history (undo/redo) and more. | ||
|
||
### Great DX | ||
Harlem has a great developer experience. It's built using TypeScript so all of your state, getters, and mutations are strongly typed. Harlem also has devtools integration so you can explore your stores and see mutation events on the timeline in realtime. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Stores | ||
|
||
In a nutshell a store is just a mechanism for storing, retrieving and mutating related data. | ||
|
||
Harlem, much like Vuex, follows a Redux-like state management pattern. Harlem's functionality can be divided into 3 main concepts: | ||
- **State** - The single source of truth for your data (read-only). See [State](/guide/core-concepts/state.html). | ||
- **Getters** - Computed side-effects of mutations to state (read-only). See [Getters](/guide/core-concepts/getters.html). | ||
- **Mutations** - The means by which state is changed (read/write). See [Mutations](/guide/core-concepts/mutations.html) | ||
|
||
**Actions** (available via the [Action extension](/extensibility/extensions/action.html)) are also a major part of a modern state management solution. Harlem's action implementation can be described as cancellable async methods for batching mutations, api requests etc (async read/write). Refer to the [FAQ section](/guide/support/FAQ.html#why-aren-t-actions-included-by-default) to see why actions aren't included in the core package by default. | ||
|
||
Where Harlem differs from Vuex is that as opposed to having one monolithic state tree, Harlem uses the concept of stores to create logical boundaries between disparate data. | ||
|
||
Instead of defining store functions (getters, mutations etc) on a single object Harlem uses a more functional approach which allows you to structure your codebase any way you like. The added benefit to this approach is that your stores can be tree-shaken not just at store level but right down to a getter/mutation level. | ||
|
||
|
||
## Defining a store | ||
|
||
To define a store all you need is a name, some initial state. | ||
|
||
```typescript | ||
import { | ||
createStore | ||
} from '@harlem/core'; | ||
|
||
export default createStore('user', { | ||
firstName: 'John', | ||
lastName: 'Smith' | ||
}); | ||
``` | ||
|
||
## Specifying options | ||
|
||
You can specifiy a range of options when creating a store. This is most useful for adding any extensions you wish to include with this store. For the complete set of options available refer to the [API documentation](/api-reference/global.html#createstore). | ||
|
||
```typescript | ||
import { | ||
createStore | ||
} from '@harlem/core'; | ||
|
||
export default createStore('user', STATE, { | ||
allowOverwrite: true, | ||
extensions: [ | ||
actionExtension() | ||
] | ||
}); | ||
``` |
Oops, something went wrong.