nanostate icon indicating copy to clipboard operation
nanostate copied to clipboard

Implementation of History API

Open brunoskonrad opened this issue 7 years ago • 3 comments

I was wondering what is the join function used in History code sample:

var nanostate = require('nanostate')

var machine = nanostate('cash', {
  cash: { check: 'check' },
  check: { cash: 'cash' }
})

machine.join('next', nanostate('review', {
  review: { previous: '$history' }
}))

What exactly is next and what it changes in machine object?

brunoskonrad avatar Jan 16 '18 17:01 brunoskonrad

Ok, I just watched the talk from David Khourshid about FSM and at https://youtu.be/VU1NKX6Qkxc?t=22m23s he spoke about History states. Is it right to assume that as an answer?

brunoskonrad avatar Jan 17 '18 01:01 brunoskonrad

I believe the history example here is based on the one in that talk, but yet to be implemented.

bcomnes avatar Jan 17 '18 17:01 bcomnes

@brunoskonrad yep, history states is exactly that. To be fair, this has felt as the most odd part of the API, so suggestions on how to improve it would be very welcome!

yoshuawuyts avatar Jan 17 '18 21:01 yoshuawuyts