Skip to content

Commit

Permalink
Added async callback
Browse files Browse the repository at this point in the history
  • Loading branch information
MicheleBertoli committed Jan 9, 2014
1 parent ccfa26b commit 34d6508
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -6,17 +6,20 @@ UnicodeFileToHtmTextConverter = function(fileBlob) {

UnicodeFileToHtmTextConverter.prototype = {

convertToHtml: function () {
convertToHtml: function (callback) {

var self = this;
var fileReader = new FileReader();
var text;
fileReader.onload = function(evt) {
text = evt.target.result;
var htmlLines = self._basicHtmlEncode(text);
if (callback) {
callback(htmlLines);
}
};
fileReader.readAsText(this._fileBlob);

var htmlLines = this._basicHtmlEncode(text);
return htmlLines;
},

_basicHtmlEncode: function (source) {
Expand Down

0 comments on commit 34d6508

Please sign in to comment.