tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Kemnade (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (TAP5-1861) Wrap javascript call rendering apis for interoperability and convenience
Date Mon, 22 Aug 2016 06:48:23 GMT

     [ https://issues.apache.org/jira/browse/TAP5-1861?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jochen Kemnade closed TAP5-1861.
--------------------------------
    Resolution: Incomplete

We assume this is no longer relevant and therefore close it.
If you still have this issue in a recent Tapestry version (such as 5.4.1 or newer), feel free
to provide the necessary information and reopen.

> Wrap javascript call rendering apis for interoperability and convenience
> ------------------------------------------------------------------------
>
>                 Key: TAP5-1861
>                 URL: https://issues.apache.org/jira/browse/TAP5-1861
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.3.2
>            Reporter: Paul Stanton
>            Assignee: Howard M. Lewis Ship
>              Labels: bulk-close-candidate
>
> Vast improvements to the ajax and javascript rendering API's have made things much easier
to use in tapestry 5.2+, however I still think there is room for improvement. I find I can't
work without this 'helper' service I designed to standardise script call rendering between
xhr and non-xhr requests. The main motivation/benefit is that a set of functionality can now
be called in either (xhr/non-xhr) context and still work. It also has the benefit of building
the necessary JavaScriptCallback in the xhr context. In my opinion, this makes user code much
tidier:
> public class JavascriptHelperImpl implements JavascriptHelper
> {
>     @Inject
>     private AjaxResponseRenderer ajaxResponseRenderer;
>     @Inject
>     private Request request;
>     @Inject
>     private JavaScriptSupport jsSupport;
>     @Override
>     public void addScript(final String format, final Object... args)
>     {
>         if (!request.isXHR())
>         {
>             jsSupport.addScript(format, args);
>             return;
>         }
>         ajaxResponseRenderer.addCallback(new JavaScriptCallback()
>         {
>             @Override
>             public void run(JavaScriptSupport javascriptSupport)
>             {
>                 javascriptSupport.addScript(format, args);
>             }
>         });
>     }
> }
> There may or may not be additional opportunity with the other methods such as 'addInitializerCall'
but I haven't needed to.
> This code is free for anyone (including apache/tapestry) to use.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message