Move HTMX code to module
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
5666f243bb
commit
4e7f4070ba
1 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,8 @@
|
||||||
import htmx from 'htmx.org';
|
import 'htmx.org';
|
||||||
import '/src/htmx_import.js'
|
import '/src/htmx_import.js'
|
||||||
import AudioMotionAnalyzer from 'audiomotion-analyzer';
|
import AudioMotionAnalyzer from 'audiomotion-analyzer';
|
||||||
htmx.onLoad(function(target) {
|
|
||||||
|
addEventListener("load", (_event) => {
|
||||||
const container = document.getElementById('audioContainer');
|
const container = document.getElementById('audioContainer');
|
||||||
const audioSource = document.getElementById('player');
|
const audioSource = document.getElementById('player');
|
||||||
const audioMotion = new AudioMotionAnalyzer(container, { source: audioSource });
|
const audioMotion = new AudioMotionAnalyzer(container, { source: audioSource });
|
||||||
|
@ -17,6 +18,6 @@ htmx.onLoad(function(target) {
|
||||||
|
|
||||||
function drawCallback(instance, _info) {
|
function drawCallback(instance, _info) {
|
||||||
const energy = instance.getEnergy() * 150;
|
const energy = instance.getEnergy() * 150;
|
||||||
target.style.setProperty('--energy', energy + 'px');
|
document.documentElement.style.setProperty('--energy', energy + 'px');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue