summaryrefslogtreecommitdiffstats
path: root/main.mjs
blob: 30542084df3c4ed8c560f637314df23e54dfc598 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import Fretboard, { fretToNote } from './fretboard.mjs';
import KeyPicker from './key-picker.mjs';
import History from './history.mjs';

function notes(form) {
    const strings = ['string1', 'string2', 'string3', 'string4', 'string5', 'string6'];
    const formData = new FormData(form);
    console.log('notes', form, formData);
    return strings.map((klass) => fretToNote(form, klass, formData.get(klass)));
}

function onSave(form) {
    console.log('we done saved', form, notes(form));
}


function main() {
    const fretboard = document.getElementById('fretboard');
    const keyPicker = document.getElementById('key-picker');
    const history = document.getElementById('history');

    Fretboard(fretboard, { onSave });
    KeyPicker(keyPicker);
    History(history, keyPicker);
}
document.addEventListener('DOMContentLoaded', main);