new DecoratorView()
Augmented.Presentation.DecoratorView
An MVVM view designed around decorating the DOM with bindings.
This concept is designed to decouple the view from the backend contract.
Although this is achieved via views in general, the idea is:
As a Javascript Developer, I'd like the ability to decorate HTML and control view rendering without the use of CSS selectors
Important to note: This view gives up it's template and events!
This is because all events and templates are used on the DOM directly.
To add custom events, use customEvents instead of 'events'
supported annotations:
- data-click
- data-function
- data-style
- data-append-template
- data-prepend-template
- Source:
Extends
Members
-
<static> customEvents
-
Custom Events Property - merge into built-in events
- Source:
Properties:
Name Type Description customEvents
Methods
-
<static> addClass(id, cls)
-
addClass - adds a class to a bount element
Parameters:
Name Type Description id
string The identifier (not id attribute) of the element
cls
string The class to add
- Source:
-
<static> bindingAttribute()
-
bindingAttribute method - Returns the binging data attribute name
- Source:
Returns:
Binding attribute name
- Type
- string
-
<static> bindModelChange(func)
-
bindModelChange method - binds the model changes to functions
Parameters:
Name Type Description func
func The function to call when changing (normally render)
- Source:
-
<static> boundElement(id)
-
boundElement method - returns the bound element from identifier
Parameters:
Name Type Description id
string The identifier (not id attribute) of the element
- Source:
Example
from HTML: <div data-myMountedView="something" id="anything"></div> from JavaScript: var el = this.boundElement("something");
-
<static> events()
-
Events Property - Do Not Override
- Source:
Properties:
Name Type Description events
-
<static> initialize()
-
Initialize method - Do Not Override
- Source:
-
<static> injectTemplate(template, mount)
-
injectTemplate method - Injects a template at a mount point
Parameters:
Name Type Description template
string The template to inject
mount
Element The mount point as Document.Element or String
- Source:
-
<static> remove()
-
Remove method - Does not remove DOM elements only bindings.
- Source:
-
<static> removeClass(id, cls)
-
removeClass - remove a class to a bount element
Parameters:
Name Type Description id
string The identifier (not id attribute) of the element
cls
string The class to remove
- Source:
-
<static> removeTemplate(mount, onlyContent)
-
removeTemplate method - Removes a template (children) at a mount point
Parameters:
Name Type Description mount
Element The mount point as Document.Element or String
onlyContent
boolean Only remove the content not the mount point
- Source:
-
<static> syncAllBoundElements()
-
syncAllBoundElements - Syncs the data of all bound elements by firing a change events
- Source:
-
<static> syncBoundElement(id)
-
syncBoundElement - Syncs the data of a bound element by firing a change event
Parameters:
Name Type Description id
string The identifier (not id attribute) of the element
- Source:
-
<static> syncModelChange(element)
-
syncModelChange method - binds the model changes to a specified bound element
Parameters:
Name Type Description element
Element The element to bind as Document.Element or string
- Source:
-
<static> unbindModelChange(func)
-
unbindModelChange method - unbinds the model changes to elements
Parameters:
Name Type Description func
func The function to call when changing (normally render)
- Source:
-
<static> unbindModelSync(element)
-
unbindModelSync method - unbinds the model changes to a specified bound element
Parameters:
Name Type Description element
Element The element to bind as Document.Element or string
- Source: