Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LiveScratcher.PlusCom
07-17-2009, 08:15 PM
Post: #1
LiveScratcher.PlusCom
Used to lay a (string-only) bridge between Plus! and LiveScratcher scripts.
in LiveScratcher call:
JAVASCRIPT Code
function onReceive(txt) {
return "NOTIMPL";
}
function onClosed() {
}
function onConnect(channel) {
channel.onReceive=onReceive;
channel.onClosed=onClosed;
}
PlusCom.register("name",onConnect);


With a callback function taking one argument (the created channel object).
Then in Plus! call:
JAVASCRIPT Code
var channel={
OnReceive:function(text) {return "NOTIMPL";},
OnClose:function() {}
};
Interop.Call("PlusCom.dll","Connect","name",channel);


This will call the "onConnect" callback with a newly created channel object.
The channel object has 2 methods:
  • close or Close (first from LS, second from Plus!)
  • send or Send
and 2 callbacks:
  • onReceive or OnReceive
  • onClosed or OnClosed

Events from Plus! should be set before Connect call (so that send from the LS callback works), Events from LiveScratcher should be set as soon as possible in the callback function. Events can be changed later on.

Note: the return value from onReceive or OnReceive will be converted to a string and returned from send or Send on the other side.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: