Read the statement by Michael Teeuw here.
What is the difference between require() and getScripts()?
-
require()
is for when you mean “I’m going to use this code somewhere else in this script I am writing right now” — i.e. somewhere on the server-side.getScripts()
is for when you mean “my client-facing/browser code will need this loaded to perform some operation” — i.e. somewhere on the client-side.(As always, this is what I understand and hope someone will correct me if I’m wrong.)
-
@ninjabreadman Aah! Finally. Thank you. That is the most sensible explanation I’ve seen.
(If you’re a moderator, please mark this as closed/solved.) -
cowboysdude Module Developerlast edited by cowboysdude Feb 20, 2018, 11:28 AM Feb 20, 2018, 11:27 AM
Well you really shouldn’t mark this as closed or solved because I’m sure others will have questions too :)
It’s a GREAT explanation… and it’s also a GREAT question!!! I’m sure others have wondered and I know people don’t usually ask for fear they’ll look ‘not smart’…but NO question is a dumb question!!
The worst question in history? The one that never got asked! :)
-
@cowboysdude said in What is the difference between require() and getScripts()?:
I know people don’t usually ask for fear they’ll look ‘not smart’
I don’t have this problem. ;-)
-
@Mykle1 said in What is the difference between require() and getScripts()?:
@cowboysdude said in What is the difference between require() and getScripts()?:
I know people don’t usually ask for fear they’ll look ‘not smart’
I don’t have this problem. ;-)
Which one? Asking or not being smart LOL
-
Both? ;-)