Miguel wrote:
This is the third or fourth time I've seen this. Looks to me like live connect is passing invalid or volatile pointers. Very bizarre. The callback mechanism clearly isn't what it should be. (No news there.) We just need to be alert to this and avoid callbacks when possible.
General question: What is your experience with running JavaScript functions based upon timers?
I am thinking of polling for events rather than callbacks.
If I read your question correctly, you are suggesting letting the JavaScript loop for events from the applet and perhaps have public access to variables that would indicate, for example, that a script has run, that the message buffer has been loaded, etc.? So one would run .script() or .loadInline() and then start polling? E.g.:
function checkQueue(){ if(document.jmol.hasMessage()){
dothis(document.jmol.getMessage())
}else{
setTimeout("checkQueue",100)
}
}Something like that?
This is not a bad idea and would work for some things.
Callbacks seem to me to be ultimately more efficient than polling. There is no "doevents()" function in Javascript to allow for the checking of events during a function's run.
My experience with setTimeout() is that it is a necessary evil for quick jumps to a new thread, allowing a sort of poor man's doevents() (from Visual Basic) but is not very efficient for continuous polling.
But it might be something to try.
Bob
Miguel
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Jmol-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jmol-developers
-- Robert M. Hanson, [EMAIL PROTECTED], 507-646-3107 Professor of Chemistry, St. Olaf College 1520 St. Olaf Ave., Northfield, MN 55057 mailto:[EMAIL PROTECTED] http://www.stolaf.edu/people/hansonr
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Jmol-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jmol-developers
