Closed flatsiedatsie closed 4 years ago
I initially had hide()
, but it seemed unnecessary. The entire panel just gets a hidden
class added, so your extension can go on updating things in the background without affecting the rest of the UI.
The code for the Extension
class lives here: https://github.com/mozilla-iot/gateway/blob/master/static/js/extension.js
Ii would actually love the hide()
function! Right now my code checks the visibility of the section
every 100 milliseconds. It ain't pretty :-)
I vote for bringing it back!
I'm not worried about the effects on the gateway interface. There are other reasons I want to unload it. It means the add-on can stop scanning the USB ports, which means there's less chance someone else on the same Gateway (another workshop participant that wants to upload code to an Arduino) will be denied access to those USB ports.
Basically, it would allow to stop heavy serverside processes then the user isn't engaged with the add-on anyway.
Why not just put a timeout on your scan and add a button to re-scan?
It's not a situation like you describe.
Basically, it continously scans while the UI is visible in order to provide a seamless experience. It's pretty nice actually.
More generally, I can imagine all kinds of serverside processes that can be spooled down if the user it no longer actually looking at the UI. E.g. machine learning on security camera footage (only show smart overlays while the user is looking at the feed), and so forth. Only downloading a stream from the internet while the user it watching the add-on, etc.
So awesome.
The javascript currently has the
show()
function. Are there others? Specifically, is there an 'official' way to unload the add-on when the user navigates away? Ahide()
function as it were?If there a location in the gateway code where all the option can be explored?