Commit 09977a82 authored by Xiaowu Zhang's avatar Xiaowu Zhang

add example of using control gadget

parent c08b51d8
/*global window, rJS, RSVP, console */ /*global window, rJS, RSVP, console */
/*jslint maxlen:80, nomen: true */ /*jslint nomen: true*/
(function (window, rJS) { (function (window, rJS) {
"use strict"; "use strict";
rJS(window).ready(function (g) { rJS(window).ready(function (g) {
// First, load the progress gadget // First, load the progress gadget
var div_context = g.__element.getElementsByTagName('div')[0]; var input_context = g.__element.getElementsByTagName('input')[0];
g.declareGadget( g.declareGadget(
'../audioplayer_progress/index.html', '../audioplayer_control/index.html'
{
element: div_context
// sandbox: 'iframe'
}
) )
.then(function (progress) { .then(function (control) {
progress.setValue(50); input_context.onchange = function () {
progress.setMax(100); control.setSong(input_context.files[0]);
return [50, 100]; control.playSong();
}) };
.then(function (e) {
console.log(e[0] + e[1]);
}) })
.fail(function (e) { .fail(function (e) {
console.log("error" + e); console.log("[ERROR]: " + e);
}); });
}); });
}(window, rJS)); }(window, rJS));
...@@ -15,12 +15,8 @@ ...@@ -15,12 +15,8 @@
</head> </head>
<body> <body>
<input type="file" id="file" name="file" multiple />
<div style="color:#00FF00" id="div">
</div>
</body> </body>
</html> </html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment