mirror of
https://github.com/zhigang1992/mobx-utils.git
synced 2026-06-13 01:18:08 +08:00
fix docs indentation
This commit is contained in:
12
README.md
12
README.md
@@ -833,13 +833,13 @@ import {actionAsync, task} from "mobx-utils"
|
||||
mobx.configure({ enforceActions: "observed" }) // don't allow state modifications outside actions
|
||||
|
||||
class Store {
|
||||
@observable githubProjects = []
|
||||
@state = "pending" // "pending" / "done" / "error"
|
||||
@observable githubProjects = []
|
||||
@state = "pending" // "pending" / "done" / "error"
|
||||
|
||||
@actionAsync
|
||||
async fetchProjects() {
|
||||
this.githubProjects = []
|
||||
this.state = "pending"
|
||||
@actionAsync
|
||||
async fetchProjects() {
|
||||
this.githubProjects = []
|
||||
this.state = "pending"
|
||||
try {
|
||||
// note the use of task when awaiting!
|
||||
const projects = await task(fetchGithubProjectsSomehow())
|
||||
|
||||
@@ -112,13 +112,13 @@ export function actionAsync<F extends (...args: any[]) => Promise<any>>(fn: F):
|
||||
* mobx.configure({ enforceActions: "observed" }) // don't allow state modifications outside actions
|
||||
*
|
||||
* class Store {
|
||||
* \@observable githubProjects = []
|
||||
* \@state = "pending" // "pending" / "done" / "error"
|
||||
* \@observable githubProjects = []
|
||||
* \@state = "pending" // "pending" / "done" / "error"
|
||||
*
|
||||
* \@actionAsync
|
||||
* async fetchProjects() {
|
||||
* this.githubProjects = []
|
||||
* this.state = "pending"
|
||||
* \@actionAsync
|
||||
* async fetchProjects() {
|
||||
* this.githubProjects = []
|
||||
* this.state = "pending"
|
||||
* try {
|
||||
* // note the use of task when awaiting!
|
||||
* const projects = await task(fetchGithubProjectsSomehow())
|
||||
|
||||
Reference in New Issue
Block a user