lit-element
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -16,2 +16,3 @@ import { html, render as litRender } from '../lit-html/lit-html.js' | ||
this.__data = {}; | ||
this._methodsToCall = {}; | ||
this.attachShadow({mode: "open"}); | ||
@@ -43,3 +44,3 @@ } | ||
this.__data[prop] = val; | ||
this._propertiesChanged() | ||
this._propertiesChanged(prop, val) | ||
} | ||
@@ -66,5 +67,12 @@ }) | ||
} else this.__data[prop] = val; | ||
this._propertiesChanged(); | ||
this._propertiesChanged(prop, val); | ||
} | ||
}); | ||
if(info.observer) { | ||
if(this[info.observer]) { | ||
this._methodsToCall[prop] = this[info.observer]; | ||
} else { | ||
console.warn(`Method ${info.observer} not defined!`); | ||
} | ||
} | ||
if(info.value) { | ||
@@ -77,5 +85,9 @@ typeof info.value === 'function' | ||
_propertiesChanged() { | ||
if(!this._wait) | ||
_propertiesChanged(prop, val) { | ||
if(this._methodsToCall[prop]) { | ||
this._methodsToCall[prop](val) | ||
} | ||
if(!this._wait) { | ||
litRender(this.render(), this.shadowRoot) | ||
} | ||
} | ||
@@ -93,3 +105,3 @@ | ||
} else this.__data[prop] = type(val); | ||
this._propertiesChanged(); | ||
this._propertiesChanged(prop, val); | ||
} | ||
@@ -96,0 +108,0 @@ } |
@@ -6,3 +6,3 @@ { | ||
"name": "lit-element", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Implements lit-html via a LitElement class. Made for custom Elements.", | ||
@@ -9,0 +9,0 @@ "main": "lit-element.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43760
104