You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.
Chrome extensions work in such a way that the popup page is reloaded every time the popup is reopened (and the popup is closed when you focus anywhere outside of the popup). It might be a good idea for simpler extensions, but in our case it's extremely annoying: when you click outside the popup because you need to e.g. copy an address, the popup goes away, and next time you open it you need to enter the PIN again, wait for it to sync, you lose any context you had, any previously entered data, etc.
AFAIK there's only one way to fix this: use the background script (background.js). Extensions can have a "background page" (just a script or a page + a script) that runs persistently in the background. However, that page/script doesn't have direct access to the popup view and vice versa - they can only communicate with messages through the Chrome API. (See more here: http://code.tutsplus.com/tutorials/developing-google-chrome-extensions--net-33076)
So this is how it could be done:
the background page/script includes stuff like syncing with the server/database, keeping the wallet in memory, checking transactions etc.
it might even include some pre-rendered UI parts on the background page
the popup includes only the UI-related parts of the app
when the popup opens, it sends a message to the background script, which responds with any data the UI needs to render itself
clicking stuff in the UI also sends messages to the background script, which does whatever it needs to do and responds with new data
However, this looks like an enormous amount of work... :\
From what I've searched on Google, there doesn't seem to be any way to prevent the popup from reloading. It's theoretically possible that an installable-to-dock app could have a more persistent UI, but I have no idea if that's the case. Those that I've tried seemed to either reload everything when I closed and reopened the window (Authy), simply quit when I close the window (Pocket, Solitaire), or even closed the window but couldn't reopen it again (Wunderlist...).
Another short-term option would be to try to optimize the startup process as much as possible - don't ask for PIN, show the main UI immediately etc.
The text was updated successfully, but these errors were encountered:
I don't see an easy way out either... Here's how we can about doing this:
I think the background script only needs the hive-wallet module and its dependencies form hive-js. And we need a wrapper around it to handle messaging with the foreground scripts, and serialize/deserialize the wallet object and transactions. The foreground script code is a modified version of current hive-js where all usages of hive-wallet (including events emitted by the hive-wallet module) are replaced with a message handler which facilitates communication between background scripts and foreground scripts.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Chrome extensions work in such a way that the popup page is reloaded every time the popup is reopened (and the popup is closed when you focus anywhere outside of the popup). It might be a good idea for simpler extensions, but in our case it's extremely annoying: when you click outside the popup because you need to e.g. copy an address, the popup goes away, and next time you open it you need to enter the PIN again, wait for it to sync, you lose any context you had, any previously entered data, etc.
AFAIK there's only one way to fix this: use the background script (
background.js
). Extensions can have a "background page" (just a script or a page + a script) that runs persistently in the background. However, that page/script doesn't have direct access to the popup view and vice versa - they can only communicate with messages through the Chrome API. (See more here: http://code.tutsplus.com/tutorials/developing-google-chrome-extensions--net-33076)So this is how it could be done:
However, this looks like an enormous amount of work... :\
From what I've searched on Google, there doesn't seem to be any way to prevent the popup from reloading. It's theoretically possible that an installable-to-dock app could have a more persistent UI, but I have no idea if that's the case. Those that I've tried seemed to either reload everything when I closed and reopened the window (Authy), simply quit when I close the window (Pocket, Solitaire), or even closed the window but couldn't reopen it again (Wunderlist...).
Another short-term option would be to try to optimize the startup process as much as possible - don't ask for PIN, show the main UI immediately etc.
The text was updated successfully, but these errors were encountered: