1.1 --- a/boot/src/main/java/net/java/html/js/JavaScriptBody.java Sat Aug 02 12:59:31 2014 +0200
1.2 +++ b/boot/src/main/java/net/java/html/js/JavaScriptBody.java Fri Dec 12 11:22:40 2014 +0100
1.3 @@ -120,4 +120,33 @@
1.4 * of the JavaScript snippet
1.5 */
1.6 public boolean wait4js() default true;
1.7 +
1.8 + /** Controls garbage collection behavior of method parameters.
1.9 + * In general JavaScript garbage
1.10 + * collection system makes it close to impossible to find out whether
1.11 + * an object is supposed to be still used or not. Some systems have
1.12 + * an external hooks to find that out (like <em>JavaFX</em> <code>WebView</code>),
1.13 + * in some systems this information is not important (like the
1.14 + * <a href="http://bck2brwsr.apidesign.org">Bck2Brwsr</a> VM running
1.15 + * all in JavaScript), but other execution systems just can't find that
1.16 + * out. To prevent memory leaks on such systems and help them manage
1.17 + * memory more effectively, those who define JavaScript interfacing
1.18 + * methods may indicate whether the non-primitive parameters passed
1.19 + * in should be hold only for the time of method invocation or
1.20 + * for the whole application lifetime.
1.21 + * <p>
1.22 + * The default value is <code>true</code> as that is compatible with
1.23 + * previous behavior and also prevents unwanted surprises when something
1.24 + * garbage collects pre-maturaly. Framework developers are however
1.25 + * encouraged to use <code>keepAlive=false</code> as much as possible.
1.26 + *
1.27 + * @return whether Java objects passed as parameters of the method
1.28 + * should be made guaranteed to be available JavaScript
1.29 + * even after the method invocation is over (e.g. prevent them to be
1.30 + * garbage collected in Java until it is known they are not needed
1.31 + * from JavaScript at all).
1.32 + *
1.33 + * @since 1.1
1.34 + */
1.35 + public boolean keepAlive() default true;
1.36 }