To show the effect of the link mode, change a little the page already used in the Basic Example.
If you open the above page in a browser, you’ll see an alert when each local script is being executed. The expected sequence is “script1″, “script2″, “script”, “main”. Deja-vue? Really it is. The expected sequence is the same as in the basic example, even if the execution is quite different.
Here “script1″ is alerted because it’s directly loaded into the page, “script2″ on the other hand is alerted because it’s required by script, which is required by main, which is directly loaded into the page. The script1 required by script before script2, is loaded in “link mode” because it was loaded before and no mode is explicitly specified, i.e. the loading is completely bypassed, and only a reference to the same object exported by the first script1 is exported to script. This can be easily verified by means of Firebug.
As you see, script1 has been loaded once, and its second entry in the goon repository is exporting exactly the same time exported by the first entry.