@@ -13,15 +13,14 @@ const Router = function (rootElement, projectConfig) {
1313
1414 let currentIndex = 0
1515 let currentStep = 0
16- let numSteps = 0
16+ // let numSteps = 0
1717
18- const setNumSteps = ( ) => {
19- numSteps = scenes [ currentIndex ] &&
18+ const numSteps = ( ) => {
19+ return scenes [ currentIndex ] &&
2020 scenes [ currentIndex ] . _steps
2121 ? scenes [ currentIndex ] . _steps . length
2222 : 0
2323 }
24- // setNumSteps()
2524
2625 const updateRouterWrapper = ( ) => {
2726 const sceneConfig = scenes [ currentIndex ]
@@ -33,7 +32,7 @@ const Router = function (rootElement, projectConfig) {
3332 }
3433
3534 this . next = ( ) => {
36- if ( currentStep === numSteps ) {
35+ if ( currentStep === numSteps ( ) ) {
3736 this . nextIndex ( )
3837 } else {
3938 currentStep ++
@@ -53,10 +52,10 @@ const Router = function (rootElement, projectConfig) {
5352 notify ( [ 'nextIndex' , 'indexChanged' ] )
5453 } else {
5554 currentIndex = numScenes ( )
56- currentStep = numSteps
55+ currentStep = numSteps ( )
5756 notify ( 'end' )
5857 }
59- setNumSteps ( )
58+ // setNumSteps()
6059 }
6160 this . prevIndex = ( ) => {
6261 if ( currentIndex > 0 ) {
@@ -68,7 +67,7 @@ const Router = function (rootElement, projectConfig) {
6867 currentStep = 0
6968 notify ( 'begin' )
7069 }
71- setNumSteps ( )
70+ // setNumSteps()
7271 }
7372
7473 this . goto = v => {
@@ -90,7 +89,7 @@ const Router = function (rootElement, projectConfig) {
9089 currentIndex,
9190 currentStep,
9291 totalScenes : this . totalScenes ( ) ,
93- totalSteps : numSteps ,
92+ totalSteps : numSteps ( ) ,
9493 isFirst : this . isFirst ( ) ,
9594 isLast : this . isLast ( )
9695 } )
@@ -120,7 +119,7 @@ const Router = function (rootElement, projectConfig) {
120119 }
121120
122121 this . totalScenes = ( ) => numScenes ( ) + 1
123- this . totalSteps = ( ) => numSteps
122+ this . totalSteps = ( ) => numSteps ( )
124123 this . currentIndex = ( ) => currentIndex
125124 this . currentStep = ( ) => currentStep
126125 this . isFirst = ( ) => currentIndex === 0
@@ -145,7 +144,7 @@ const Router = function (rootElement, projectConfig) {
145144
146145 setTimeout ( ( ) => {
147146 notify ( 'init' )
148- setNumSteps ( )
147+ // setNumSteps()
149148 } )
150149}
151150
0 commit comments