summaryrefslogtreecommitdiffstats
path: root/src/js/app.js
diff options
context:
space:
mode:
authorHumberto Alfonso Díaz <humberto.alfonso@asvito.es>2019-09-23 11:32:30 +0200
committerLorenzo Tilve <ltilve@igalia.com>2020-02-04 09:42:15 +0100
commit783be0ef4f7302ca722ab3224f2c9a98e355b8da (patch)
tree3885f63801f453638f868c4b76ff0fc5d6a6c8e3 /src/js/app.js
parent202c99424446aaf2145932f02dca00209e7a6888 (diff)
FUNCT Add support to modify sliders
Diffstat (limited to 'src/js/app.js')
-rw-r--r--src/js/app.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/js/app.js b/src/js/app.js
new file mode 100644
index 0000000..773e5b0
--- /dev/null
+++ b/src/js/app.js
@@ -0,0 +1,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);
+} \ No newline at end of file