choojs / nanocomponent

🚃 - create performant HTML components
https://leaflet.choo.io/
MIT License
366 stars 30 forks source link

'load' and 'unload' events are not called when using electron (node integration) #62

Closed ojack closed 7 years ago

ojack commented 7 years ago

I am getting strange behavior when I use electron's built-in node integration to require nanocomponent rather than browserify.

When running the nanocomponent examples within electron, 'load' and 'unload' events are never called, even though the element is mounted to and removed from the dom. No errors are logged, and the rest of the events, including 'beforerender' all seem to behave as documented.

i don't know enough about any of the involved projects to know why there would be a difference/whether it is expected! I can include more information + code if it is helpful =]

bcomnes commented 7 years ago

Can you confirm you are running 6.4.2? Also what version of electron are you running?

ojack commented 7 years ago

version 6.4.2 of nanocomponent, version 6.3.0 of choo, and version 1.6.11 of electron

bcomnes commented 7 years ago

Hrmm... I'll verify this weekend. Our tests run in electron actually (via https://github.com/juliangruber/tape-run) so they work to some extent.

If you have a code example that reproduces the issue that would be super helpful.

ojack commented 7 years ago

oops, just seeing this now!

I uploaded an example at https://github.com/ojack/nanocomponent-onload

bcomnes commented 7 years ago

Whats probably going on is that the https://github.com/shama/on-load/blob/master/server.js version is getting loaded instead of the actual module.

bcomnes commented 7 years ago

We should add an explicit test to that file to check if its running in an electron environment and load in the correct version if thats the case. Sorry to take so long on this, but occurred to me in the shower the other day.

bcomnes commented 7 years ago

This will be closed by https://github.com/shama/on-load/pull/32

bcomnes commented 7 years ago

@ojack should be working now. Sorry for the long delay in gettin this fixed.

bcomnes commented 7 years ago

Closing, let me know if there are any other issues.