[Pkg-javascript-commits] [less.js] 170/285: set less.hasFinished to refresh() promise
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:23:51 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag v2.0.0
in repository less.js.
commit 999af91bb38ee1480ea4a3a24e12ee25c34e8a40
Author: Levi Thomason <me at levithomason.com>
Date: Tue Oct 14 00:19:07 2014 -0700
set less.hasFinished to refresh() promise
fix white space
return promise on modifyVars
---
lib/less-browser/index.js | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/lib/less-browser/index.js b/lib/less-browser/index.js
index 32cca36..1157d36 100644
--- a/lib/less-browser/index.js
+++ b/lib/less-browser/index.js
@@ -239,12 +239,12 @@ for (var i = 0; i < links.length; i++) {
// CSS without reloading less-files
//
less.modifyVars = function(record) {
- less.refresh(false, record);
+ return less.refresh(false, 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) {
@@ -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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git
More information about the Pkg-javascript-commits
mailing list