Skip to content

Commit

Permalink
set less.hasFinished to refresh() promise
Browse files Browse the repository at this point in the history
fix white space
  • Loading branch information
levithomason committed Oct 14, 2014
1 parent a0b1b2f commit 337699f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/less-browser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ less.modifyVars = function(record) {
};

less.refresh = function (reload, modifyVars) {
return new PromiseConstructor(function(resolve, reject) {
var startTime, endTime;
less.hasFinished = new PromiseConstructor(function (resolve, reject) {
var startTime, endTime, totalMilliseconds;
startTime = endTime = new Date();

loadStyleSheets(function (e, css, _, sheet, webInfo) {
Expand All @@ -262,14 +262,22 @@ less.refresh = function (reload, modifyVars) {
}
less.logger.info("css for " + sheet.href + " generated in " + (new Date() - endTime) + 'ms');
if (webInfo.remaining === 0) {
less.logger.info("less has finished. css generated in " + (new Date() - startTime) + 'ms');
resolve();
totalMilliseconds = new Date() - startTime;
less.logger.info("less has finished. css generated in " + totalMilliseconds + 'ms');
resolve({
startTime: startTime,
endTime: endTime,
totalMilliseconds: totalMilliseconds,
sheets: less.sheets.length
});
}
endTime = new Date();
}, reload, modifyVars);

loadStyles(modifyVars);
});

return less.hasFinished;
};

less.refreshStyles = loadStyles;
Expand Down

0 comments on commit 337699f

Please sign in to comment.