Replies: 1 comment 3 replies
-
const protoState = van.state(0).__proto__
Object.prototype.abc = function (ab) {
for (const key in ab) {
if (key == 'abc') continue
console.log(Object.getPrototypeOf(ab[key]), protoState, Object.getPrototypeOf(ab[key])===protoState)
if (Object.getPrototypeOf(ab[key])===protoState) {
van.derive(() => this.setAttribute(key, ab[key].val));
} else {
this.setAttribute(key, ab[key]);
}
};
return this
}; I do not recommend you to do this, the best option is to initialize immediately as shown below button({ onclick: () => ++counter.val, c: counter, text:counter }, "👍") |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to add extension to van so I can override and add new attributes:
While Its working(the attributed added to the element html), the value not updates when state changed :
What am I missing here?
Beta Was this translation helpful? Give feedback.
All reactions