1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-07-01 20:32:13 +02:00

Signals finalization

This commit is contained in:
2023-09-07 17:35:23 +02:00
parent 55a8f14b6b
commit 6fae2fc4e6
5 changed files with 215 additions and 161 deletions

View File

@ -12,13 +12,15 @@ const className= style.host(todosComponent).css`
}
`;
/** @param {{ todos: string[] }} */
export function todosComponent({ todos= [] }= {}){
const todosS= S(todos.map(v=> S(v)), {
export function todosComponent({ todos= [ "A" ] }= {}){
const todosS= S([], {
/** @param {string} v */
add(v){ this.value.push(S(v)); },
/** @param {number} i */
remove(i){ this.value.splice(i, 1); }
remove(i){ this.value.splice(i, 1); },
[S.symbols.onclear](){ S.clear(...this.value); },
});
todos.forEach(v=> S.action(todosS, "add", v));
console.log(todosS); //TODO
const name= "todoName";
const onsubmitAdd= on("submit", event=> {