prop-bind
Create a property that changes value base another property
example
Create an element and bind the prop:
var propBind = { thischecked = false}
Then when the element is used:
var button = console // = 'my-button not-checked' buttonchecked = trueconsole // = 'my-button is-checked'
api
propBind(object, property, binding)
object
- The object that contains the properties.property
- The name of the property to create.binding
- The string to create the bindings.
The binding
is space separated and the syntax can be:
':raw-string'
- Values starting with:
are treated as raw strings.'property'
- Will switch between'property'
and''
.'property:on:off'
- Will switch between'on'
and'off'
whetherproperty
istrue
orfalse
.'property::off'
- Will switch between''
and'off'
whetherproperty
istrue
orfalse
.
license
(c) 2015 Kyle Robinson Young. MIT License