Sunday, August 6, 2017

visibilitychange event

I wanted to know when the visibilitychange event was fired (ie: the browser is minimised).  I've coded it in JavaScript, as I couldn't see it being supported in GWT:

private static native final String getVisibilityState() /*-{
return document.visibilityState;
}-*/;
private static native final void listenForVisibliltyChange(Command onChange) /*-{
document.addEventListener("visibilitychange", function() {
onChange.@com.google.gwt.user.client.Command::execute(*)();
}, false);
}-*/;

I'm not sure if doing calls like this causes memory leaks or anything.  Please shout out if you know of any issues doing it this way.

Thanks.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment