You are reading a single comment by @sameh.hady and its replies. Click here to read the full conversation.
  • I have a question, lets say i have a big function called bigFunction() that is being called inside Testing module in connect() function. If I packaged this function as a module and called it something like bigFunction and instead of calling this function from my Testing module I do a require("bigFunction").

    When will the require do its job and grab the file? when i require the Testing module or when I call the function that requires it?

    require("Testing") <--- Will it be loaded here?
    require("Testing").connect() <--- includes require("bigFunction") or only here?

    What I want is to only grab the big function if I required it to save space and memory

About

Avatar for sameh.hady @sameh.hady started