• Time is not a function

    From Kirkman@VERT/GUARDIAN to All on Sat Jan 3 12:16:03 2015
    I have noticed that when I'm working on JS projects for the board, if I doãsomething dumb that crashes the script, sometimes it affects other javascriptãcomponents on the board.ããFor example, say I'm writing a game, and I leave out a curly brace orãsomething. The BBS will throw an error. I'll fix my code, but then later when Iãgo to post a message, SlyEdit crashes on launch with the error "time is not aãfunction."ããI have seen this "time is not a function" many times with other JS parts of theãboard, like games. It only happens if I did something in my own code thatãerrored out first.ããThe only fix is to reboot the machine. ããI'm just wondering: why does this happen? Why should my script's error thenãlater cause other components of the board to not work?ãã--Joshãã////--------------------------------------------------ãBiC -=- http://breakintochat.com -=- bbs wiki and blogãã---ã þ Synchronetã
  • From Digital Man@VERT to Kirkman on Sun Jan 4 19:12:36 2015
    Re: Time is not a functionã By: Kirkman to All on Sat Jan 03 2015 12:16 pmãã > I have noticed that when I'm working on JS projects for the board, if I doã > something dumb that crashes the script, sometimes it affects otherã > javascript components on the board.ã >ã > For example, say I'm writing a game, and I leave out a curly brace orã > something. The BBS will throw an error. I'll fix my code, but then laterã > when I go to post a message, SlyEdit crashes on launch with the error "timeã > is not a function."ã >ã > I have seen this "time is not a function" many times with other JS parts ofã > the board, like games. It only happens if I did something in my own codeã > that errored out first.ããHow is *your code* being executed? If executed correctly (e.g. via an external ãconfigured with a "?script" command-line) the script should execute in its own ãJS context and not be able to corrupt others.ããtime() is a global function (a.k.a. method) in the Synchronet object model, so ãit is possible that if your script executes in the same context and somehow ãdeletes or overwrites the time() function that could trigger the error, but I ãdon't think that would be normal.ãã > The only fix is to reboot the machine.ããReally? Just restarting Synchronet should fix any JS context stuff. Or even ãjust logging off and back on again. Or recycling the terminal server. Rebooting ãthe entire computer is certainly overkill.ãã digital manããSynchronet "Real Fact" #24:ãThe Digital Dynamics company ceased day-to-day opperations in late 1995.ãNorco, CA WX: 59.6øF, 44.0% humidity, 5 mph NNW wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Kirkman@VERT/GUARDIAN to Digital Man on Wed Mar 11 10:52:44 2015
    Re: Time is not a functionã By: Digital Man to Kirkman on Sun Jan 04 2015 07:12 pmãã >> I have noticed that when I'm working on JS projects for the board, ifã >> I do something dumb that crashes the script, sometimes it affectsã >> other javascript components on the board.ãã >> For example, say I'm writing a game, and I leave out a curly brace orã >> something. The BBS will throw an error. I'll fix my code, but thenã >> later when I go to post a message, SlyEdit crashes on launch with theã >> error "time is not a function."ãã DM> time() is a global function (a.k.a. method) in the Synchronet objectã DM> model, so it is possible that if your script executes in the same contextã DM> and somehow deletes or overwrites the time() function that could triggerã DM> the error, but I don't think that would be normal.ããFWIW, I ran into this again today and tracked it down. I have a series ofãhelper functions that I call from my doors. One of these modifies theãDate.prototype to add a method. Inside that, I declared a "time" variableãwithout using "var." This must be where it was colliding with the globalãfunction. ããFor now I've renamed the variable to "t" and added "var" so it's local. ButãI'll probably redo all that stuff eventually since it's a bad idea to modifyãprototypes like that.ãã--Joshãã////--------------------------------------------------ãBiC -=- http://breakintochat.com -=- bbs wiki and blogãã---ã þ Synchronetã