How it works...

The blabbers always know their line because they communicate indirectly through the store.

If you look closely, the blabbers themselves have no state. Yeah they have a UUID (Universally Unique Identifier), but that is just to give them an identity, and it never really changes.

Their state is centralized in the store, and the actor array will look like this during execution:

[{   uuid:0.9775738039368538,   line:"'Quo vadis?'" }, {   uuid:0.7398549831424475,   line:"Oh, what does it mean?" }]

Thanks to Vue reactivity, the component is just a mirror of this state.

The communication, while indirectly, is done in the store. Every 2 seconds, a nextLine mutation is issued:

nextLine (state) {     state.currentActor =   (state.currentActor ...

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.