vertx-bus-bower icon indicating copy to clipboard operation
vertx-bus-bower copied to clipboard

Unregister handler with lamdba function as callback

Open Jean-PhilippeGouin opened this issue 5 years ago • 2 comments

Hi ,

To unregister an handler, we have to pass to callback function used during the register.

However when using typescript , i use lambda function :

...
 this.eventBus.registerHandler('/' + projectId
        + '.' + faulttreeId + '/' + 'diag', {} ,(err, resp)=>{
                            console.log(resp);
                            this.handleServerResponse(child.data.uuid,resp);
                        });

However it is impossible to unregister this handler ...

This is due to this var idx = handlers.indexOf(callback); which return -1.

Jean-PhilippeGouin avatar May 25 '19 16:05 Jean-PhilippeGouin

I think we could return either the address or the index and use that as the key to unregister.

pmlopes avatar May 27 '19 07:05 pmlopes

Yes that would be great indeed !

Jean-PhilippeGouin avatar May 27 '19 08:05 Jean-PhilippeGouin