Skip to content

Remove global var usage from controller .js files #75

@ccmitchellusa

Description

@ccmitchellusa

The controller .js files that correspond to the views should not have references to globals, for example todoApp that's referenced in many places (there are a few other application-wide objects and collections hanging off of that instance).

ViewControllers have a reference to their parent "App Controller" already, so we should at a minimum access these objects off of the app controller instance.

Helpers can/should be created by subclassing Application. See src.js, where the Application instance is created. Instead, create a TodoApplication class which extends Application and adds accessors for application-wide objects. The individual view controller's can then use the helpers directly to access these objects.

If these objects really don't need to be application-wide, and are used by a narrower set of view controllers, they can be associated with a parent controller that has access to the application itself, but scopes the variable access to a narrower set of view controller children. This help with reuse, rather than glomming a bunch of objs onto the app controller, they can be grouped/organized in larger apps.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions