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
S
ScriptyChris623d ago
Why not use modules?
R
RelativPerspektiv623d ago
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
S
ScriptyChris623d 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?
R
RelativPerspektiv623d ago
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 ?
S
ScriptyChris623d ago
Kind of, yes
UU
Unknown User623d ago