You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basic setup of a component follows native JS pattern.
classCardextendsComponent{constructor(){this.classname="card";}events(_){// Just a wrapper for addEventListener scoped only for class="approve" elements in a card component.// And "_" gives you access to the component's API._.e("click",".approve",_.approve);_.e("click",".reject",_.reject);}api(){// This is a separate component we made elsewhere.constnotification=newNotification();return{approve(_){_.set_color("green");},reject(_){_.set_color("red");},set_color(color,_){_.me.classList.add(`card-${color}`);_.save_card_to_database({id: _.me.index,color: color});// Call the api of another componentnotification.show("Color has been changed");},save_card_to_database(data,_){// ...}}}}
To get an array of the cards with all the functional goodies:
Basic setup of a component follows native JS pattern.
To get an array of the cards with all the functional goodies:
Another idea
These events will only fire for elements with the specified classname and their children.
The text was updated successfully, but these errors were encountered: