Skip to content
Snippets Groups Projects
Verified Commit 5b164772 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: bind this to callback and fix timing #158 #164

parent 9f6d5f8a
No related branches found
No related tags found
No related merge requests found
...@@ -290,8 +290,9 @@ function getControlEventHandler() { ...@@ -290,8 +290,9 @@ function getControlEventHandler() {
if (element === undefined) { if (element === undefined) {
return; return;
} }
setTimeout(() => {
retrieveAndSetValue.call(this, element); retrieveAndSetValue.call(this, element)
}, 0);
}; };
return this[symbol]; return this[symbol];
...@@ -305,6 +306,7 @@ function getControlEventHandler() { ...@@ -305,6 +306,7 @@ function getControlEventHandler() {
* @private * @private
*/ */
function retrieveAndSetValue(element) { function retrieveAndSetValue(element) {
const pathfinder = new Pathfinder(this[internalSymbol].subject.getSubject()); const pathfinder = new Pathfinder(this[internalSymbol].subject.getSubject());
let path = element.getAttribute(ATTRIBUTE_UPDATER_BIND); let path = element.getAttribute(ATTRIBUTE_UPDATER_BIND);
...@@ -936,7 +938,7 @@ function addObjectWithUpdaterToElement(elements, symbol, object) { ...@@ -936,7 +938,7 @@ function addObjectWithUpdaterToElement(elements, symbol, object) {
const cb = this?.[updaterTransformerMethodsSymbol] const cb = this?.[updaterTransformerMethodsSymbol]
if (this instanceof HTMLElement && (typeof cb === "function")) { if (this instanceof HTMLElement && (typeof cb === "function")) {
let callbacks = cb(); let callbacks = cb.call(this);
if (typeof callbacks === "object") { if (typeof callbacks === "object") {
for (const [name, callback] of Object.entries(callbacks)) { for (const [name, callback] of Object.entries(callbacks)) {
if (typeof callback === "function") { if (typeof callback === "function") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment