Comments (2)
You could dispatch an event to outside, like that:
this.base.parentElement.dispatchEvent('my-event', new Event())
, and then, execute your function outside the component, adding an event listener to your custom element reference:
myComponent.addEventListener('my-event', e => {
// your code
})
this is an example when you are using preact with vanilla JS.
from preact-custom-element.
The fix is released as part of 4.0.0
🎉
from preact-custom-element.
Related Issues (20)
- In Firefox, The Custom Element gets cloned when calling member function of props, like toUpperCase()
- Hydration with shadow root doesn't work HOT 2
- Hyphenated attributes and camelCased properties
- How do I use with unpkg? HOT 1
- Document behavior for multi-word attributes/props?
- I can't use hook HOT 3
- package does not work HOT 1
- Observed attributes break context providers
- Feature Request: Use the "render" function of preact/compat
- Preact Component's constructor is not called when custom element is created via document.createElement HOT 1
- It resets complex property to undefined when provided as second or later prop
- Expose methods HOT 2
- Interop problems with Svelte
- Add support for {mode: 'closed'}
- Pass the created HTML node to the preact component HOT 1
- Generating preact-ce.module.js HOT 1
- Extend element instead of creating new custom element
- [Improvment] Add documentation or template for vite HOT 5
- Slots fail to pass as props when element is created after register() is called HOT 3
- Publish to npm 🙏 HOT 2
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 preact-custom-element.