Timeline for Better way to share JavaScript code
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 25 at 20:10 | history | edited | konijn | CC BY-SA 4.0 |
added 86 characters in body
|
Sep 25 at 20:08 | comment | added | konijn | All fair points. I updated my answer. | |
Sep 25 at 19:45 | comment | added | KRyan |
This is not an IIFE. As your link says, another—perhaps clearer—name for the pattern is “self-executing anonymous function.” This function is neither self-executing nor anonymous. This is just calling a function—which is a good suggestion, but this answer should not mislead about the meaning of “IIFE.” An IIFE is when you define and invoke a function all at once, e.g. (function () { /*…*/ })(); or (() => /*…*/)(); . A real IIFE wouldn’t actually help much here; the whole point is to have the single shared initializeMapLogic function that you could call in each page.
|
|
Sep 25 at 18:54 | comment | added | Bergi |
Notice that initializeMapLogic is still a global.
|
|
Sep 25 at 18:53 | comment | added | Bergi | "an IIFE that you call" - huh? | |
Sep 25 at 7:45 | vote | accept | Yohannes Kifle | ||
Sep 25 at 7:31 | history | answered | konijn | CC BY-SA 4.0 |