Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Circuit8/stimulus-existence
get dom added events and remove elements with Stimulus
https://github.com/Circuit8/stimulus-existence
Last synced: about 2 months ago
JSON representation
get dom added events and remove elements with Stimulus
- Host: GitHub
- URL: https://github.com/Circuit8/stimulus-existence
- Owner: Circuit8
- Created: 2020-06-23T15:21:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T17:03:11.000Z (almost 2 years ago)
- Last Synced: 2024-04-21T03:07:47.368Z (9 months ago)
- Language: JavaScript
- Size: 1.18 MB
- Stars: 10
- Watchers: 3
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-stimulusjs - stimulus-existence - Stimulus controller to remove elements from the dom, and be notified with an event when they are added. (Packages)
README
# Stimulus Existence
Stimulus controller to remove elements from the dom, and be notified with an event when they are added.
## Installation
```shell
$ yarn add stimulus-existence
```## Usage
Register the controller with Stimulus:
```javascript
// application.js
import { Application } from "stimulus";
import { ExistenceController } from "stimulus-existence";const application = Application.start();
application.register("existence", ExistenceController);
```Initialize the controller on a container element, use the `remove()` action to delete the entire container. Listen to `existence:added` events to discover when your container has been added to the dom. Useful for Rails Ujs Dom HTML additions, and hooking up with other controllers.
```html
Close me
```## Contributing
Fork the project.
Install dependencies
```shell
$ yarn install
```Write some tests, and add your feature. Send a PR.