mtscout6/knockout — comment on commit c697f6fbd74cfd51e5513e0c60eb167065ece198
File: src/namespace.js line 1
By neonstalwart:

i remember now... and you can decide whatever makes sense to you on this one.

ignoring AMD for a minute, just consider how the code exists without these changes. when you use the advanced optimizations in google closure, all your non-exported names become a garbled mess and this `ko` object is not actually `window[ko]` but rather a closure bound variable that may or may not be called `ko` - maybe it becomes compressed to `z`. everything in the source files that is something like `ko.foo.bar` becomes `z.j.h` or something just as arbitrarily unrecognizable. only things that are explicitly exported actually have identifiable names. that means that if you inspect `window[ko]` you'll only find the meaningful names attached to that object.

now, let's bring AMD into the picture. if `window[ko]` is analogous to the export of the ko module then we only want to see the meaningful names attached to the export of the ko module - `koExports` - and we keep all the garbled names internal by attaching them to `ko`. this means that inspecting `window[ko]` or the ko module export will give you an object that looks the same in both cases. it also means that if for some reason we were intentionally not exposing certain properties via `exportSymbol` then those properties would not be exported from the ko module.

i distinctly remember now that i intentionally decided to mimic this behavior so that the properties found on `window[ko]` when not using AMD would be the same properties found on the export of the ko module when using AMD. if you decide that this is not necessary then we can go with what you're suggesting.