Re: jsinterop with browser-specific api

2016-09-12 Thread Zufar Fakhurtdinov
Thank you for answer! Writing it by hand is annoying, but maybe later it 
will be generated.
Maybe you know.. How can I use 'in' operator?

protected static native boolean pointerLockSupported() /*-{
  return 'pointerLockElement' in $wnd.document ||
  'mozPointerLockElement' in $wnd.document ||
  'webkitPointerLockElement' in $wnd.document;
}-*/;

-- 
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+unsubscr...@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.


jsinterop with browser-specific api

2016-09-09 Thread Zufar Fakhurtdinov
Hi all. I'm trying to understand how can I effective work with jsinterop 
and browser-specific api.
For example Fullscreen api is mostly work in latest browsers, but methods 
are prefixed.

Before jsinterop I was write something like this:


public static native void leaveFullscreen() /*-{
  if ($doc.cancelFullscreen) {
$doc.cancelFullscreen();
  } else if ($doc.mozCancelFullScreen) {
$doc.mozCancelFullScreen();
  } else if ($doc.webkitCancelFullScreen) {
$doc.webkitCancelFullScreen();
  }

}-*/; 

What should I do now? Add mozCancelFullScreen, webkitCancelFullScreen 
methods to my jsinteropped Document interface? And then add static jsni 
method 
boolean exists(Object a)/*-{return a;}-*/; and add java method with "if 
(exists(..))"  chain. 
It looks very verbose and inefficiently.

-- 
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+unsubscr...@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.