You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Adam X <vb...@gmail.com> on 2016/09/22 15:54:17 UTC

org.apache.tapestry5.services.javascript.Initialization.with(Object... arguments)

Is there a reason this is not a fluid setter? Right now I have to do:

Initialization foo = jsSupport.require("foo");
foo.with("bar");
foo.invoke("myFunc");

I'd rather just do:

jsSupport.require("foo").with("bar").invoke("myFunc")


but with(Object...) returns void :(

Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: org.apache.tapestry5.services.javascript.Initialization.with(Object... arguments)

Posted by ra...@aol.com.
Wouldn't  jsSupport.require("foo").invoke("myFunc").with("bar"); Work?


IMHO if the library is your own (a bit from a mixin that adds a spinner on ajax buttons and then removes it on a response), 



ajaxResponseRenderer.addCallback((JavaScriptCallback) javascriptSupport -> {
            javascriptSupport.require("spin.wait").with(new JSONObject().put("spinWaitId", id));
        });


define(["jquery"], function ($) {
   return function (response) {
       $('#' + response.spinWaitId).find('button').removeClass('loading');
   } 
});



-----Original Message-----
From: Adam X <vb...@gmail.com>
To: Tapestry users <us...@tapestry.apache.org>
Sent: Thu, Sep 22, 2016 11:54 am
Subject: org.apache.tapestry5.services.javascript.Initialization.with(Object... arguments)

Is there a reason this is not a fluid setter? Right now I have to do:

Initialization foo = jsSupport.require("foo");
foo.with("bar");
foo.invoke("myFunc");

I'd rather just do:

jsSupport.require("foo").with("bar").invoke("myFunc")


but with(Object...) returns void :(

Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



Re: org.apache.tapestry5.services.javascript.Initialization.with(Object... arguments)

Posted by Adam X <vb...@gmail.com>.
I was thinking about that but never tried as it doesn't seem intuitive
at all :) But thanks for the hint, I will refactor.

Adam

On Thu, Sep 22, 2016 at 6:06 PM, Cezary Biernacki <ce...@gmail.com> wrote:
> You can do:
>
> jsSupport.require("foo").invoke("myFunc").with("bar");
>
> Best regards,
> Cezary
>
>
> On Thu, Sep 22, 2016 at 5:54 PM, Adam X <vb...@gmail.com> wrote:
>
>> Is there a reason this is not a fluid setter? Right now I have to do:
>>
>> Initialization foo = jsSupport.require("foo");
>> foo.with("bar");
>> foo.invoke("myFunc");
>>
>> I'd rather just do:
>>
>> jsSupport.require("foo").with("bar").invoke("myFunc")
>>
>>
>> but with(Object...) returns void :(
>>
>> Adam
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: org.apache.tapestry5.services.javascript.Initialization.with(Object... arguments)

Posted by Cezary Biernacki <ce...@gmail.com>.
You can do:

jsSupport.require("foo").invoke("myFunc").with("bar");

Best regards,
Cezary


On Thu, Sep 22, 2016 at 5:54 PM, Adam X <vb...@gmail.com> wrote:

> Is there a reason this is not a fluid setter? Right now I have to do:
>
> Initialization foo = jsSupport.require("foo");
> foo.with("bar");
> foo.invoke("myFunc");
>
> I'd rather just do:
>
> jsSupport.require("foo").with("bar").invoke("myFunc")
>
>
> but with(Object...) returns void :(
>
> Adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>