• Using sbbsdefs and userdefs

    From Nelgin@VERT/EOTLBBS to digital man on Wed Aug 16 14:12:36 2023
    Hi am I supposed to use sbbsdefs.js and userdefs.js in the same script?ããI'm using several properties from userdefs so I haveããrequire("sbbsdefs.js", 'USER_EXPERT');ãload("userdefs.js");ããbut my script complains aboutããTypeError: redeclaration of const USER_DELETEDããSince sbbsdefs is only importing USER_EXPERT, shouldn't it ignore the definition of USER_DELETED ? And why would it be defined in there when it's already defined in userdefs.js?ããNightfox suggested if I use require with userdefs then it might look at the other properties anyway, but that's not the case.ããWould appreciate some advice please.ããThanks,ã---ã þ Synchronet þ End Of The Line BBS - endofthelinebbs.comã
  • From Digital Man@VERT to Nelgin on Wed Aug 16 12:59:03 2023
    Re: Using sbbsdefs and userdefsã By: Nelgin to digital man on Wed Aug 16 2023 02:12 pmãã > Hi am I supposed to use sbbsdefs.js and userdefs.js in the same script?ããNo, since sbbsdefs.js already requires userdefs.js, you don't need to use (load or require) both.ãã > I'm using several properties from userdefs so I haveã >ã > require("sbbsdefs.js", 'USER_EXPERT');ã > load("userdefs.js");ã >ã > but my script complains aboutã >ã > TypeError: redeclaration of const USER_DELETEDããUsing require() instead of load() would fix that.ãã > Since sbbsdefs is only importing USER_EXPERT, shouldn't it ignore theã > definition of USER_DELETED ? And why would it be defined in there when it'sã > already defined in userdefs.js?ã >ã > Nightfox suggested if I use require with userdefs then it might look at theã > other properties anyway, but that's not the case.ã >ã > Would appreciate some advice please.ããThe second argument to require() is just one variable name that you expect to be defined in the required script, not all of the variable names that you expect to be defined. The entire script that you require() is evaluated if the specified named variable is not defined.ã-- ã digital man (rob)ããThis Is Spinal Tap quote #11:ãNigel Tufnel: No. no. That's it, you've seen enough of that one.ãNorco, CA WX: 95.9øF, 35.0% humidity, 4 mph E wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Nelgin@VERT/EOTLBBS to Digital Man on Wed Aug 16 15:11:40 2023
    Re: Using sbbsdefs and userdefsã By: Digital Man to Nelgin on Wed Aug 16 2023 12:59:03ãã > No, since sbbsdefs.js already requires userdefs.js, you don't need to useã > (load or require) both.ããOK got it. I think the problem stemmed from me accidentally removing the require for text.js. I added that back and it's good now.ããThanks for the response.ã---ã þ Synchronet þ End Of The Line BBS - endofthelinebbs.comã
  • From Nightfox@VERT/DIGDIST to Digital Man on Wed Aug 16 14:11:07 2023
    Re: Using sbbsdefs and userdefsã By: Digital Man to Nelgin on Wed Aug 16 2023 12:59 pmãã DM> The second argument to require() is just one variable name that you expectã DM> to be defined in the required script, not all of the variable names thatã DM> you expect to be defined. The entire script that you require() isã DM> evaluated if the specified named variable is not defined.ããSo for require(), if you want to be able to use everything from the required file, would you omit the 2nd argument (or pass an empty string)? In my .js scripts, I have passed a variable name as the 2nd argument for require(), and I have been able to use other variables from that .js as well.ããNightfoxãã---ã þ Synchronet þ Digital Distortion: digitaldistortionbbs.comã
  • From Digital Man@VERT to Nightfox on Wed Aug 16 14:35:55 2023
    Re: Using sbbsdefs and userdefsã By: Nightfox to Digital Man on Wed Aug 16 2023 02:11 pmãã > Re: Using sbbsdefs and userdefsã > By: Digital Man to Nelgin on Wed Aug 16 2023 12:59 pmã >ã > DM> The second argument to require() is just one variable name that youã > DM> expect to be defined in the required script, not all of the variableã > DM> names that you expect to be defined. The entire script that youã > DM> require() is evaluated if the specified named variable is not defined.ã >ã > So for require(), if you want to be able to use everything from the requiredã > file, would you omit the 2nd argument (or pass an empty string)?ããNo, you would pass *one* of your *required* symbols (functions or variables) from the child script. Anything else defined in that file just comes along for free.ãã > In my .jsã > scripts, I have passed a variable name as the 2nd argument for require(),ã > and I have been able to use other variables from that .js as well.ããRight, and that's how it's supposed to work.ã-- ã digital man (rob)ããBreaking Bad quote #13:ãI got twenty bucks that says he's a beaner. - Hank SchraderãNorco, CA WX: 96.6øF, 31.0% humidity, 10 mph SSE wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Nightfox@VERT/DIGDIST to Digital Man on Wed Aug 16 15:08:26 2023
    Re: Using sbbsdefs and userdefsã By: Digital Man to Nightfox on Wed Aug 16 2023 02:35 pmãã >> So for require(), if you want to be able to use everything from theã >> required file, would you omit the 2nd argument (or pass an empty string)?ãã DM> No, you would pass *one* of your *required* symbols (functions orã DM> variables) from the child script. Anything else defined in that file justã DM> comes along for free.ããThat's what I remembered (and how it seemes to be working).. Just wanted to make sure.ããNightfoxãã---ã þ Synchronet þ Digital Distortion: digitaldistortionbbs.comã