[infinispan-dev] Infinispan Javascript client 0.1.0 is out now!

Ladislav Thon lthon at redhat.com
Fri Feb 19 04:44:51 EST 2016


Inline.

> Would it be possible to have a syntax like this?
> 
> connected
>      .then(function(client) {
>          client.put('key', 'value');
>      .then(function(client) {
>          client.get('key').use(function(value) {
>              console.log(':get(`key`) = ' + value);
>          }).save('p0'); // this would be the same as use(function(value) 
> { client.save('p0') })
>      }.
>      .then(function(client)) {
>          client.remove('key', client.load('p0')).use(function(success) {
>              console.log(':remove(`key`) = ' + success);
>          });
>      }).exec();

JavaScript people have been using promises for quite a while and there's
a multitude of opensource implementations.

They also made it to ECMAScript 6 [1] and TC39 is even working on
async/await (which of course builds on promises) [2].

I would personally claim that using callbacks in JS is no longer
acceptable :-), but then, I'm a JS hater, so...

[1] http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects
[2] https://tc39.github.io/ecmascript-asyncawait/

LT

> 
> Note that I've used conditional remove to demonstrate load of previously 
> saved value. Also, I am mixing the concept of client = cache and 
> session, but maybe these could go to single object.
> 
> Just my 2c
> 
> Radim
> 
> On 02/18/2016 12:04 PM, Galder Zamarreño wrote:
>> Hi,
>>
>> Following on Tristan's anouncement, we've also released Infinispan Javascript client version 0.1.0. You can read all about it here:
>> http://blog.infinispan.org/2016/02/infinispan-javascript-client-010-is-out.html
>>
>> Cheers,
>> --
>> Galder Zamarreño
>> Infinispan, Red Hat
>>
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
> 
> 



More information about the infinispan-dev mailing list