1.1 --- a/boot/src/main/java/org/apidesign/html/boot/spi/Fn.java Tue Jan 07 15:52:26 2014 +0100
1.2 +++ b/boot/src/main/java/org/apidesign/html/boot/spi/Fn.java Tue Jan 07 17:20:53 2014 +0100
1.3 @@ -116,6 +116,20 @@
1.4 }
1.5
1.6 private static final Map<String,Set<Presenter>> LOADED = new HashMap<String, Set<Presenter>>();
1.7 +
1.8 + /** Wraps function to ensure that the script represented by <code>resource</code>
1.9 + * gets loaded into the browser environment before the function <code>fn</code>
1.10 + * is executed.
1.11 + *
1.12 + * @param fn original function to call
1.13 + * @param caller the class who wishes to define/call the function
1.14 + * @param resource resources (accessible via {@link ClassLoader#getResource(java.lang.String)})
1.15 + * with a <em>JavaScript</em> that is supposed to loaded into the browser
1.16 + * environment
1.17 + * @return function that ensures the script is loaded and then delegates
1.18 + * to <code>fn</code>
1.19 + * @since 0.7
1.20 + */
1.21 public static Fn preload(final Fn fn, final Class<?> caller, final String resource) {
1.22 return new Fn() {
1.23 @Override