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

add example of using control gadget

parent c08b51d8
/*global window, rJS, RSVP, console */
/*jslint maxlen:80, nomen: true */
/*jslint nomen: true*/
(function (window, rJS) {
"use strict";
rJS(window).ready(function (g) {
// First, load the progress gadget
var div_context = g.__element.getElementsByTagName('div')[0];
var input_context = g.__element.getElementsByTagName('input')[0];
g.declareGadget(
'../audioplayer_progress/index.html',
{
element: div_context
// sandbox: 'iframe'
}
'../audioplayer_control/index.html'
)
.then(function (progress) {
progress.setValue(50);
progress.setMax(100);
return [50, 100];
})
.then(function (e) {
console.log(e[0] + e[1]);
.then(function (control) {
input_context.onchange = function () {
control.setSong(input_context.files[0]);
control.playSong();
};
})
.fail(function (e) {
console.log("error" + e);
console.log("[ERROR]: " + e);
});
});
}(window, rJS));
......@@ -15,11 +15,7 @@
</head>
<body>
<div style="color:#00FF00" id="div">
</div>
<input type="file" id="file" name="file" multiple />
</body>
......
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