A Polymer 2.x mixin that provides some useful methods for data bindings. See the listing on webcomponents.org for full documentation (You'll need to click on "Show N protected methods" to see them).
<dom-module id="my-element">
<template>
<style>
:host {
display: block;
}
</style>
<template is="dom-if" if="[[_isTruthy(foo)]]">
foo is: truthy
</template>
<template is="dom-if" if="[[_isFalsey(foo)]]">
foo is: falsey
</template>
</template>
<script>
/**
* @customElement
* @polymer
* @appliesMixin Polymer.SCDataBindingHelpers
*/
class MyElement extends Polymer.SCDataBindingHelpers(Polymer.Element) {
static get is() {
return 'my-element';
}
static get properties() {
return {
foo: {
type: String,
value: 'foo'
}
};
}
}
customElements.define(MyElement.is, MyElement);
</script>
</dom-module>