bruth/synapse — Issue #9: Define formal the supported types via Interface classes
Author: bruth
Created: 2011-10-09 16:47:05+00:00
State: open

Currently, the term _interface_ in Synapse lingo refers to, more specifically, the ``set/getHandler`` for DOM elements. Interfaces are now intended to refer to classes which all contain a common API for interfacing with one another including:

- ``bind``, ``unbind``, and ``trigger`` - the typical event methods common to ``Backbone.Events`` and jQuery/Zepto
- ``observe``, ``unobserve``, and ``sync`` - the primary methods for setting up a one-way or two-way binding
- ``get`` and ``set`` - common API for getting/setting data for the underlying object (regardless of the type)

The hierarchy would look something like this:

- ``Interface`` (default)
- ``ElementInterface`` - for interfacing with single DOM elements (no child nodes)
- ``FragmentInterface`` - for interfacing with a DOM element's child nodes
- ``ViewInterface`` - for ``Backbone.View`` instances, uses either ``ElementInterface`` or ``FragmentInterface`` internally
- ``ModelInterface`` - for ``Backbone.Model`` instances
- ``CollectionInterface`` - for ``Backbone.Collection`` instances

Each of these classes would have the above defined APIs for trivially interfacing with one another and it provides a mechanism for supporting additional types of objects from other libraries (e.g. Dojo, Spine, etc.)