Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added async callback

  • Loading branch information...
commit 34d650860c60ca1bbedf7bcc0824c003fbd87b16 1 parent ccfa26b
@MicheleBertoli MicheleBertoli authored
View
9 TDDMicroExercises/Javascript/unicode-file-to-htm-text-converter/unicode-file-to-htm-text-converter.js
@@ -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) {
Please sign in to comment.
Something went wrong with that request. Please try again.