Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 551 Bytes

namespace.md

File metadata and controls

24 lines (18 loc) · 551 Bytes

All JavaScript objects should be namespaced under window

class window.Foo
  constructor: ->
    console.log 'foo'

$ ->
  new window.Foo

Related JavaScript should be further namespaced:

window.SomeComponent ||= {} # this is required to ensure that SomeComponent exists before adding an object on it

class window.SomeComponent.Things
  constructor: ->
    console.log 'some component-namespaced things'

class window.SomeComponent.OtherThings
  constructor: ->
    console.log 'some component-namespaced other things'