Commit 3d561951 authored by Jérome Perrin's avatar Jérome Perrin

GUI: new utily method to read a file as data uri

parent 2eec3380
......@@ -88,4 +88,18 @@
});
};
window.promiseReadAsDataURL = function (file) {
return new RSVP.Promise(function (resolve, reject) {
var reader = new FileReader();
reader.onload = function (evt) {
resolve(evt.target.result);
};
reader.onerror = function (evt) {
reject(evt);
};
reader.readAsDataURL(file);
});
};
}(window, RSVP, FileReader));
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