Lifecycle example doesn't work

Fuse version 0.26.0 (build 7741) OSX El Capitan 10.11.6

I’m trying to call a javascript function when a Page is activated (so I can reset some observables back to their default values).

Steps:

  1. Download https://github.com/fusetools/fuse-samples
  2. Preview it (Local)

Nothing is printed in the monitor and as I click on other apps and back to it, the background color does not change. I believe I should see “Hello” in the monitor and the color should change from Green to Yellow and back again as it gains and looses focus.

Hi,

The Lifecycle events don’t fire on desktop/local preview. Try it on the device, and it should work :slight_smile:

Ahh, thanks Anders!

That’s too bad…If it’s not difficult to change, I wonder if it could be an enhancement at some point?

Also, I may have missed it, but I didn’t see that (Lifecycle events don’t fire on desktop/local preview) when I read: https://www.fusetools.com/docs/fusejs/lifecycle

Wait a minute…

According to: https://github.com/fusetools/fuse-samples/tree/master/Samples/Lifecycle:

The events onEnteringInteractive and onExitedInteractive are used to handle loss and gain of control. On desktop, this would fire when you loose/gain focus of the app’s window.

I’m pretty sure that’s saying lifecycle events DO fire on desktop.

Those docs seem a bit confusing. We’ll look into it and improve the docs. Thanks!