Web Plugins and the views hide event


John Clarke

When the view for the plugin is displayed it's show event is triggered. But when it disappears its hide event isn't triggered.


decsoft

Hello John,

The view's Hide event are mainly intended to be used when the user changes into another app's view. I think this also works as expected in WebExtensions. However, the WebExtensions itself do not offers something like an "on close popup" event, so, we simply can't use something like that.

I think the best can be to try to do the things in another manner, that is, don't rely in something like that. Maybe it's possible to do something about, but, probably a bit tricky. For example, you can attach a "body click" event in the WebExtension's content, because, when the user click the page, if the WebExtension's popup is open, become closed.



John Clarke
Essentially my plugin has a view and when this view closes I want the app to do something as the view disappears.

decsoft

Hello John,

If you need to do something when a view is change to another view, then yes, the view's Hide event can be used, however, unfortunately there is nothing like a "popup close event" (which is what I understand that you wanted, do something when the WebExtension's popup is closed), but the browsers do not provide something like that, John.



John Clarke
The view has a text box on it. When the view disappears I want it to store the value of that text box in the browsers storage. What would be the best way to achieve this ?

decsoft

Hello John,

I think the best way is to use a Save button, below the text box, for example. Something like "Press here to save", so the user know that, if he want to save that text box, must press the Save button. Another possible way (but I probably prefer the first one) is to use the text box keyup event, so you can save the text box content just when the user type on it. I prefer the first way, however, probably the second one can be also take in consideration.



John Clarke
I used the KeyUp event and that has achieved what I needed to do. Thanks.

decsoft

Hello John,

Yes;... I mean... I told you about the possible usage of a push button, and, thinking twice, probably the keyup event can be nice for this specific case and similar ones.


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.