summaryrefslogtreecommitdiffstats
path: root/src/js/app.js
blob: 773e5b0c1be5617088e4cf25de740dfe1d88ec8d (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
27
28
29
import Mustache from 'mustache';
import { init as init_sliders } from './sliders';

var template;

function render_sliders(sliders) {
    var sliderContainer = document.getElementById('SliderContainer');
    for( var i=0; i<sliders.length; i++) {
        var node = Mustache.render(template, sliders[i]);
        sliderContainer.innerHTML += node;
    }
}

export function init() {
    template = document.getElementById('slider-template').innerHTML;
    Mustache.parse(template);

    var sliders =  [];
    for( var i=0; i<10; i++) {
        sliders.push({
            id: i,
            name: 'Volume '+i,
            value: Math.floor(Math.random()*100)
        });
    }

    init_sliders(sliders);
    render_sliders(sliders);
}