phetsims / phet-core

Core utilities used by all PhET simulations.
MIT License
8 stars 6 forks source link

namespacing of inner classes #59

Closed pixelzoom closed 5 years ago

pixelzoom commented 5 years ago

This issue captures decisions related to our 4/15/19 discussion of the Namespace pattern in phet-software-design-patterns.md, led by @jonathanolson.

"Class" herein means classes and types.

Decisions:

const myNamespace = require(...);

class SlotMachineNode extends Node {
  constructor( ... ) {
    this.leverNode = new LeverNode(...);
    ...
  }
 ...
}

myNamespace.register( 'SlotMachineNode', SlotMachineNode );

class LeverNode extends Node { 
 ...
}

myNamespace.register( 'SlotMachineNode. LeverNode', LeverNode );

return SlotMachineNode;

Tasks:

pixelzoom commented 5 years ago

Done, closing.