()
| 165 | } |
| 166 | |
| 167 | function playNextScene () { |
| 168 | if (props.status === 'stopping') { |
| 169 | props.status = 'ready' |
| 170 | return this |
| 171 | } |
| 172 | |
| 173 | if (props.status !== 'playing') return this |
| 174 | |
| 175 | if (props.currentScene + 1 >= props.scenario.length) { |
| 176 | props.status = 'ready' |
| 177 | publish('scenario:end') |
| 178 | return this |
| 179 | } |
| 180 | |
| 181 | let nextScene = props.scenario[++props.currentScene] |
| 182 | |
| 183 | if (props.currentScene === 0) { |
| 184 | publish('scenario:start') |
| 185 | } |
| 186 | |
| 187 | if (nextScene.name === 'publisher') { |
| 188 | const [done, ...args] = nextScene.args |
| 189 | publish(...args) |
| 190 | |
| 191 | return done() |
| 192 | } |
| 193 | |
| 194 | if (nextScene.actor) { |
| 195 | setCurrentActor(nextScene.actor) |
| 196 | } |
| 197 | |
| 198 | publish(`${nextScene.name}:start`, nextScene) |
| 199 | |
| 200 | switch (nextScene.name) { |
| 201 | case 'type': |
| 202 | typeAction(...nextScene.args) |
| 203 | break |
| 204 | |
| 205 | case 'erase': |
| 206 | eraseAction(...nextScene.args) |
| 207 | break |
| 208 | |
| 209 | case 'callback': |
| 210 | callbackAction(...nextScene.args) |
| 211 | break |
| 212 | |
| 213 | case 'wait': |
| 214 | waitAction(...nextScene.args) |
| 215 | break |
| 216 | |
| 217 | default: |
| 218 | console.debug(`No scene handler for ${nextScene.name}`) |
| 219 | break |
| 220 | } |
| 221 | |
| 222 | return this |
| 223 | } |
| 224 |
no test coverage detected