Hopefully this can be anwered quick.

I am trying to move the (Chatzilla) socket code into a component. There is
one place that I am stuck, and that is how to handle the async stuff:

Socket.prototype.async = function(handler)
{
   this.async = handler;
   this._channel.asyncRead (new SocketListener(), this, 0, -1, 0);
}

SocketListener.prototype.onDataAvailable = function(channel, ctxt, inStr,
sourceOffset, count)
{
   ctxt = ctxt.wrappedJSObject;

   if (!ctxt._inputStream)
      ctxt._inputStream = ctxt.toScriptableInputStream(inStr);

   X ctxt.async(ctxt.read());
}

where X is a problem, as ctxt.async does not exist at that point. Otherwise
ctxt is fine, and shows a Socket constructor.

Thanks!
Eric



Reply via email to