Monday, November 08, 2010 at 12:00 AM.
scripting2Suite.threadScript
on threadScript () { <<Changes <<8/18/10; 8:41:25 AM by DW <<Comment out the realtime update watcher. We have now released I/O as a builtin function of the OPML Editor, no longer part of Scripting2. <<7/6/10; 8:04:01 AM by DW <<Open the workspace on launch if pref is set. <<6/6/10; 2:50:44 PM by DW <<Created. local (adrdata = scripting2suite.init (), now = clock.now ()); adrdata^.stats.ctThreadLoops++; scripting2Suite.editor.checkWatchedFolder (); bundle { //open workspace on launch if pref set if adrdata^.editor.prefs.flOpenWorkspaceOnLaunch { if not defined (system.temp.scripting2.editor.flLaunched) { scripting2Suite.editor.openWorkspace ()}}; system.temp.scripting2.editor.flLaunched = true}}; <<bundle //realtime update watcher <<if adrdata^.editor.prefs.flRealtimeEnabled and adrdata^.editor.stats.flPasswordValid <<local (server = string (adrdata^.editor.prefs.server)) <<local (username = adrdata^.editor.prefs.username) <<local (password = string (adrdata^.editor.prefs.password)) <<realtime.client.start ("scripting2", server, username, password, @scripting2Suite.editor.io.incomingUpdate) <<local (flstart = true) <<if defined (system.temp.scripting2.editor.idRealtimeThread) <<flstart = not thread.exists (system.temp.scripting2.editor.idRealtimeThread) <<if flstart <<thread.callscript (@scripting2Suite.editor.getRealtimeUpdates, {}) <<bundle //check for expired realtime update tables <<local (adrusers = @system.temp.scripting2.server.users, adruser, startticks = clock.ticks ()) <<for adruser in adrusers <<if defined (adruser^.realtimeUpdates) <<local (i, adrsub, marktime = now - (2*60)) //two minutes <<for i = sizeof (adruser^.realtimeUpdates) downto 1 <<adrsub = @adruser^.realtimeUpdates [i] <<if timeCreated (adrsub) < marktime <<delete (adrsub) <<adrdata^.stats.ctTicksRealtimeCollection = clock.ticks () - startticks //for debugging bundle { //test code threadScript ()}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.