1
1
import * as CR from 'typings'
2
+ import * as selectors from '../../selectors'
2
3
import channel from '../../channel'
3
4
4
5
export default {
5
- tutorialConfig ( context :CR . MachineContext ) {
6
+ initializeTutorial ( context :CR . MachineContext ) {
6
7
// setup test runner and git
7
8
const { tutorial} = context
8
9
if ( ! tutorial ) {
@@ -29,13 +30,34 @@ export default {
29
30
}
30
31
} )
31
32
} ,
32
- loadLevel ( ) :void {
33
- // load step actions
33
+ loadLevel ( context :CR . MachineContext ) :void {
34
+ const level = selectors . currentLevel ( context )
35
+ if ( level . setup ) {
36
+ // load step actions
37
+ channel . editorSend ( {
38
+ type :'STEP_ACTIONS' ,
39
+ payload :level . setup ,
40
+ } )
41
+ }
34
42
} ,
35
- loadStage ( ) :void {
36
- // load step actions
43
+ loadStage ( context :CR . MachineContext ) :void {
44
+ const stage = selectors . currentStage ( context )
45
+ if ( stage . setup ) {
46
+ // load step actions
47
+ channel . editorSend ( {
48
+ type :'STEP_ACTIONS' ,
49
+ payload :stage . setup ,
50
+ } )
51
+ }
37
52
} ,
38
- loadStep ( ) :void {
39
- // load step actions
53
+ loadStep ( context :CR . MachineContext ) :void {
54
+ const step = selectors . currentStep ( context )
55
+ if ( step . setup ) {
56
+ // load step actions
57
+ channel . editorSend ( {
58
+ type :'STEP_ACTIONS' ,
59
+ payload :step . setup ,
60
+ } )
61
+ }
40
62
} ,
41
63
}