C Listener to JS listener

Hi

I have some working C++ code that I need to bind to js.

The C++ code does this…

  1. I have Object that describes an event received from my server. ex.
class ServerEvent {
 ... 
}
  1. I have a function that set the Listener and calls a function in that object when a new event is received.
void setEventListener( ServerEvent * Event)

I want to do the same from js, I already binded function setEventListener to Js and I am trying to pass js function so it will be called when an event arrives.

var doOnEventReceived = function( event )
{
cc.log( event);
...
}

sdkbox.pluginname.setEventListener( doOnEventReceived );

Any idea or sample code?