BIOLOGY SCIENCE – 06-37 Aug 4

using data in different files [JS HTML] is it good to take advantage of globally scoped variables ? https://gist.github.com/biologyscience/e27a13cc1d528232de39200221a58262 or use events to transfer data within files https://gist.github.com/biologyscience/295be8fc18a36ed9c73bc67bcdfc36f8
6 Replies
ScriptyChris
ScriptyChris2y ago
Why not use modules?
RelativPerspektiv
yea i could, but im using events because, i want the thing to execute only when something is ready (something like that), so ill fire the event when the thing is basically ready to use. the example which i have given in the code is basic, my main use case is bit too big, so yea
ScriptyChris
ScriptyChris2y ago
If you are able to dispatch an event when something is ready then why can't you call specific function, which would be important? I guess you use a subscriber pattern?
RelativPerspektiv
yea i could do that, but lets say my situation is kinda like, i have the important functions in a seperate file and wanted to use when something is ready i could do export the function and import it when i need it, but basically i dont want to import and export things, thats why i choose events in the first place isnt that basically a type of event system ?
ScriptyChris
ScriptyChris2y ago
Kind of, yes
reactibot
reactibot2y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1004639235069972490