Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleSimple event Lazy-loaded namespace
EventNamespace: 'app.domain'
EventAttribute: '$ app.domain.function(eventSource);'

...

Code Block
languagejs
titleEvent Lazy-loaded namespace with automatic namespacedetection
EventNamespace: 'app.domain'
EventAttribute: '$ eventNamespace.function(eventSource);'

The last mentioned issue with the centralized logic was the polluted global scope.
To keep the global context clean, the '#' reserved namespace was introduced.
By using it, the namespace is loaded into the object at runtime, but is never exposed outside of it:

Code Block
languagejs
titleEncapsulated lazy-loaded namespace
EventNamespace: '#'
EventAttribute: '$ #.function(eventSource);'