浏览代码

Change watch interval from default 100ms to 1000ms to reduce CPU usage

Gary Hsu 7 年之前
父节点
当前提交
99e4895e49
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      Tools/Gulp/gulpfile.js

+ 5 - 4
Tools/Gulp/gulpfile.js

@@ -473,21 +473,22 @@ gulp.task("typescript-all", function (cb) {
  * Watch ts files and fire repective tasks.
  */
 gulp.task("watch", [], function () {
-    var tasks = [gulp.watch(config.typescript, ["typescript-compile"])];
+    var interval = 1000;
+    var tasks = [gulp.watch(config.typescript, { interval: interval}, ["typescript-compile"])];
 
     config.modules.map(function (module) {
         config[module].libraries.map(function (library) {
-            tasks.push(gulp.watch(library.files, function () {
+            tasks.push(gulp.watch(library.files, { interval: interval}, function () {
                 console.log(library.output);
                 return buildExternalLibrary(library, config[module], true)
                     .pipe(debug());
             }));
-            tasks.push(gulp.watch(library.shaderFiles, function () {
+            tasks.push(gulp.watch(library.shaderFiles, { interval: interval}, function () {
                 console.log(library.output);
                 return buildExternalLibrary(library, config[module], true)
                     .pipe(debug())
             }));
-            tasks.push(gulp.watch(library.sassFiles, function () {
+            tasks.push(gulp.watch(library.sassFiles, { interval: interval}, function () {
                 console.log(library.output);
                 return buildExternalLibrary(library, config[module], true)
                     .pipe(debug())