Comments (2)
I think this depends on where the name to be changed would be recorded; how it would be changed. For example, if your custom element had a name attribute that would be changed, you could respond to it using the lifecycle callbacks, as explained in https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#Using_the_lifecycle_callbacks.
Or if your custom element used a template containing a slot that would have the name in, and it was editable, you could listen for the slot being changed. See https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_templates_and_slots for basic slots explanation, and https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/slotchange_event for the relevant event to listen for.
from web-components-examples.
Thank you very much. I used custom attributes plus "eval ()" to fulfill my requirements.
...
<user-card
onChangeName="changeName"
>
</user-card>
...
...
this.addEventListener('changeNameCallback', eval(changeNameCallback));
...
from web-components-examples.
Related Issues (20)
- HTMLELEMENT CAN pass the paramers to the outter ? HOT 5
- Order of script and webcomponent HOT 6
- License information and file are missing HOT 1
- How to initialize a web component from JavaScript? HOT 9
- CSP HOT 6
- expanding-list-web-component err HOT 1
- Word count counts itself HOT 2
- getAttribute always return null HOT 2
- popup-info-box-web-component violates HTML spec HOT 1
- Actively Maintained? HOT 1
- IE is dead, Time for modern code HOT 1
- Falsy comment in the word-count-web-component javascript file. HOT 1
- Add form-associated element example HOT 2
- En tΓͺte du CV
- Approving good
- EditableList's attribute-based approach makes for a confusing example HOT 1
- Improve readability for 'simple-template' example HOT 4
- [spam] HOT 2
- this.shadowRoot is not defined HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web-components-examples.