Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4be011f

Browse files
committed
setup start w/ continue or new
1 parent32edbcf commit4be011f

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

‎src/state/actions/index.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
exportdefault{}
1+
import{send}from"xstate";
2+
import*asstoragefrom'../../services/storage'
3+
import*asgitfrom'../../services/git'
4+
5+
exportdefault{
6+
start:async()=>{
7+
const[tutorial,progress,hasGit,hasGitRemote]=awaitPromise.all([
8+
storage.getTutorial(),
9+
storage.getProgress(),
10+
git.gitVersion(),
11+
git.gitCheckRemoteExists(),
12+
])
13+
constcanContinue=!!(tutorial&&progress&&hasGit&&hasGitRemote)
14+
send(canContinue ?'CONTINUE' :'NEW')
15+
}
16+
}

‎src/state/guards/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
exportdefault{}
1+
2+
exportdefault{
3+
4+
}

‎src/state/machine.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,10 @@ export const tutorialMachine = Machine<
1818
initial:'initial',
1919
states:{
2020
initial:{
21+
onEntry:'start',
2122
on:{
22-
START:[
23-
{
24-
target:'continue',
25-
cond:'hasExistingTutorial',
26-
},
27-
{
28-
target:'new',
29-
},
30-
],
23+
CONTINUE:'continue',
24+
NEW:'new',
3125
},
3226
},
3327
new:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp