fix: remove $State debug message
This commit is contained in:
defaultkavy 2024-05-15 18:54:44 +08:00
parent 7f8f599b8a
commit 72f617df3c
2 changed files with 4 additions and 4 deletions

View File

@ -2,18 +2,18 @@ export interface $StateOption<T> {
format: (value: T) => string; format: (value: T) => string;
} }
export class $State<T> { export class $State<T> {
readonly value: T; readonly value!: T;
readonly attributes = new Map<Object, Set<string | number | symbol>>(); readonly attributes = new Map<Object, Set<string | number | symbol>>();
options: Partial<$StateOption<T>> = {} options: Partial<$StateOption<T>> = {}
constructor(value: T, options?: $StateOption<T>) { constructor(value: T, options?: $StateOption<T>) {
this.value = value; this.set(value);
if (options) this.options = options; if (options) this.options = options;
} }
set(value: T) { set(value: T) {
(this as Mutable<$State<T>>).value = value; (this as Mutable<$State<T>>).value = value;
// update element content for eatch attributes
for (const [node, attrList] of this.attributes.entries()) { for (const [node, attrList] of this.attributes.entries()) {
for (const attr of attrList) { for (const attr of attrList) {
console.debug(node, attr)
//@ts-expect-error //@ts-expect-error
if (node[attr] instanceof Function) { if (node[attr] instanceof Function) {
//@ts-expect-error //@ts-expect-error

View File

@ -1,7 +1,7 @@
{ {
"name": "elexis", "name": "elexis",
"description": "Build Web in Native JavaScript Syntax", "description": "Build Web in Native JavaScript Syntax",
"version": "0.2.2", "version": "0.2.3",
"author": { "author": {
"name": "defaultkavy", "name": "defaultkavy",
"email": "defaultkavy@gmail.com", "email": "defaultkavy@gmail.com",