Created
February 29, 2024 21:05
-
-
Save romanbsd/4122d6594f235677cc42318205ef6509 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Chart from 'stimulus-chartjs' | |
// Connects to data-controller="async-chart" | |
export default class extends Chart { | |
static values = { | |
url: String | |
} | |
connect() { | |
fetch(this.urlValue) | |
.then(response => response.json()) | |
.then(data => { | |
this.dataValue = data | |
super.connect() | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment