question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Are the .on's not emitting?

See original GitHub issue

it seems like the machine.on(‘x’, cb) things aren’t happening for me

var nanostate = require('nanostate')

var machine = nanostate('idle', {
  idle: { click: 'loading' },
  loading: { resolve: 'data', reject: 'error' },
  data: { click: 'loading' },
  error: { click: 'loading' }
})

console.log(machine.state)
machine.emit('click')
console.log(machine.state)

machine.on('idle', () => console.log('on idle'))
machine.on('loading', () => console.log('on loading'))

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ladukecommented, Feb 7, 2018

thanks for working with my bad example where i send events before i register listeners for them 😅

1reaction
karenielcommented, Feb 7, 2018

okay so the events -are- being emitted but we are emitting the original event name (ie: ‘click’), not the state name. i checked the docs and it seems to suggest that the latter is the expected behavior. gonna make a quick pr.

Read more comments on GitHub >

github_iconTop Results From Across the Web

About ONS business surveys - Office for National Statistics
No. Although ONS appreciated the time and effort you take to complete our surveys, it is unable to offer payment as completing the...
Read more >
Does the Product Emit Radiation? - FDA
Most radiation-emitting products are not considered to be medical devices. However, if you make any medical claims, your product is a ...
Read more >
An update on ONS's plans to transform the population and ...
Administrative data are a rich source of data and have the potential to transform the way in which we gather demographic data.
Read more >
Effects of poverty on mental health in the UK working-age ...
AbstractBackground. Addressing poverty through taxation or welfare policies is likely important for public mental health; however, ...
Read more >
Universal Credit statistics, 29 April 2013 to 13 January 2022
Not all new claims go on to “start” on Universal Credit ... The number of people on Universal Credit who were not working...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found