Commits

kai zhu committed 36e04b1

create moduleCron in moduleUnused

  • Participants
  • Parent commits 11fa7fa

Comments (0)

Files changed (4)

File moduleInit.js

       EXPORTS.FS_MODULE = EXPORTS.FS_MODULE || EXPORTS.requirePath.dirname(module.filename);
       EXPORTS.FS_MODULE_EXTERNAL = EXPORTS.FS_MODULE_EXTERNAL || EXPORTS.requirePath.dirname(require.resolve('tinyjs-external'));
       EXPORTS.IS_CLI = EXPORTS.IS_CLI || module === require.main;
+      EXPORTS.IS_NODEJS = EXPORTS.IS_NODEJS || true;
       EXPORTS.JSLINT_WATCH = EXPORTS.JSLINT_WATCH || {};
       EXPORTS.MODULE = EXPORTS.MODULE || module;
       EXPORTS.MODULES = EXPORTS.MODULES || {};

File moduleMain.js2

 /*FILE_BEG {"actions": ["jslint", "cover", "eval"], "name": "/FS_MODULE/moduleMain.js"}*/
 /*jslint bitwise: true, evil: true, indent: 2, nomen: true, regexp: true, stupid: true*/
 
-(function moduleCron() {
-
-  'use strict';
-
-  var EXPORTS = process.EXPORTS || {}, local = {
-
-    _init: function () {
-      //// EXPORTS
-      EXPORTS.exportLocal(local);
-      EXPORTS.CRON = EXPORTS.CRON || { day: {}, hour: {}, minute: {}, second: {} };
-      // EXPORTS.CRON_ID = EXPORTS.CRON_ID || setInterval(local._setInterval, 1000);
-    },
-
-    // _setInterval: function () {
-      // var arr, date, kk;
-      // date = new Date();
-      // if(date.getHours() < EXPORTS.CRON.date.getHours()) {EXPORTS.ooEachCall(EXPORTS.CRON.day);}
-      // if(date.getHours() !== EXPORTS.CRON.date.getHours()) {EXPORTS.ooEachCall(EXPORTS.CRON.hour);}
-      // if(date.getMinutes() !== EXPORTS.CRON.date.getMinutes()) {EXPORTS.ooEachCall(EXPORTS.CRON.minute);}
-      // if(date.getSeconds() !== EXPORTS.CRON.date.getSeconds()) {EXPORTS.ooEachCall(EXPORTS.CRON.second);}
-      // EXPORTS.ooEachCall(EXPORTS.CRON.tick); EXPORTS.CRON.date = date; EXPORTS.CRON.time = date.getTime();
-      // if(EXPORTS.EXIT && EXPORTS.ooLen(EXPORTS.CRON.tick) <= 0) {
-        // EXPORTS.printj('exiting ...'); EXPORTS.ooEachCall(EXPORTS.ON_EXIT); clearInterval(EXPORTS.CRON.intervalid);
-        // arr = EXPORTS.FS_WATCH_FILES;
-        // for(kk in arr) {if(arr.hasOwnProperty(kk)) {rqd.fs.unwatchFile(kk);}}
-        // if(EXPORTS.REPL) {EXPORTS.tmTask(process.exit, 8000);}
-      // }
-    // }
-
-  };
-
-  local._init();
-
-}());
-
-
+'use strict';
 
 (function moduleGist() {
 
-  'use strict';
-
-  var EXPORTS = process.EXPORTS || {}, local = {
+  var EXPORTS = process.EXPORTS, local = {
 
     _init: function () {
       //// EXPORTS
 
     uuid4: function () {
       //// return uuid4 string of form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
-      var uuid = '', ii;
+      var id = '', ii;
       for (ii = 0; ii < 32; ii += 1) {
         switch (ii) {
         case 8:
         case 20:
-          uuid += '-';
-          uuid += (Math.random() * 16 | 0).toString(16);
+          id += '-';
+          id += (Math.random() * 16 | 0).toString(16);
           break;
         case 12:
-          uuid += '-';
-          uuid += '4';
+          id += '-';
+          id += '4';
           break;
         case 16:
-          uuid += '-';
-          uuid += (Math.random() * 4 | 8).toString(16);
+          id += '-';
+          id += (Math.random() * 4 | 8).toString(16);
           break;
         default:
-          uuid += (Math.random() * 16 | 0).toString(16);
+          id += (Math.random() * 16 | 0).toString(16);
         }
       }
-      return uuid;
+      return id;
     }
 
   };
 
 (function moduleRepl() {
 
-  'use strict';
-
-  var EXPORTS = process.EXPORTS || {}, local = {
+  var EXPORTS = process.EXPORTS, local = {
 
     _init: function () {
       //// EXPORTS
 
 (function () {
 
-  'use strict';
-
-  var EXPORTS = process.EXPORTS || {}, local = {
+  var EXPORTS = process.EXPORTS, local = {
 
     _init: function () {
       //// EXPORTS
 
 (function () {
 
-  'use strict';
-
-  var EXPORTS = process.EXPORTS || {}, local = {
+  var EXPORTS = process.EXPORTS, local = {
 
     _init: function () {
       //// EXPORTS
 
 (function () {
 
-  'use strict';
-
-  var EXPORTS = process.EXPORTS || {}, local = {
+  var EXPORTS = process.EXPORTS, local = {
 
     _init: function () {
       if (!EXPORTS.HTTP_PORT) { return; }
 
 (function () {
 
-  'use strict';
-
-  var EXPORTS = process.EXPORTS || {}, local = {
+  var EXPORTS = process.EXPORTS, local = {
 
     _init: function () {
       //// EXPORTS
 
 (function () {
 
-  'use strict';
-
-  var EXPORTS = process.EXPORTS || {}, local = {
+  var EXPORTS = process.EXPORTS, local = {
 
     _init: function () {
       //// EXPORTS
 
 
 
-/**
- * @module moduleMain
- */
+(function moduleClient() {
+
+  var EXPORTS = process.EXPORTS, local = {
+
+    _init: function () {
+    }
+
+  };
+
+  local._init();
+
+}());
+
 
-(function () {
 
-  'use strict';
+(function moduleMain() {
 
-  var EXPORTS = process.EXPORTS || {}, local = {
+  var EXPORTS = process.EXPORTS, local = {
 
     _init: function () {
       //// EXPORTS

File moduleUnused.js2

-/**
- * unused code
- * @class EXPORTS libUnused
- * @module libUnused.js2
- */
-
-
-
 /*FILE_BEG {"actions": ["jslint"], "name": "/FS_MODULE/libUnused.js"}*/
 /*jslint bitwise: true, indent: 2, nomen: true*/
-(function () {
-  'use strict';
+
+'use strict';
+
+(function moduleUnused() {
 
   var EXPORTS = process.EXPORTS, local = {
 
   };
 
 }());
+
+
+
+(function moduleCron() {
+
+  var EXPORTS = process.EXPORTS, local = {
+
+    _init: function () {
+      //// EXPORTS
+      EXPORTS.moduleCron = moduleCron;
+      EXPORTS.CRON_DATE = EXPORTS.CRON_DATE || new Date();
+      EXPORTS.CRON_DAY = EXPORTS.CRON_DAY || {};
+      EXPORTS.CRON_HOUR = EXPORTS.CRON_HOUR || {};
+      EXPORTS.CRON_INTERVAL_ID = EXPORTS.CRON_INTERVAL_ID || setInterval(local._setInterval, 1000);
+      EXPORTS.CRON_MINUTE = EXPORTS.CRON_MINUTE || {};
+      EXPORTS.CRON_SECOND = EXPORTS.CRON_SECOND || {};
+    },
+
+    _objectEachCall: function (obj) {
+      var key;
+      for (key in obj) { if (obj.hasOwnProperty(key)) { obj[key](); } }
+    },
+
+    _setInterval: function () {
+      var arr, date, kk;
+      date = new Date();
+      if (date.getHours() < EXPORTS.CRON_DATE.getHours()) {
+        local._objectEachCall(EXPORTS.CRON_DAY);
+      }
+      if (date.getHours() !== EXPORTS.CRON_DATE.getHours()) {
+        local._objectEachCall(EXPORTS.CRON_HOUR);
+      }
+      if (date.getMinutes() !== EXPORTS.CRON_DATE.getMinutes()) {
+        local._objectEachCall(EXPORTS.CRON_MINUTE);
+      }
+      if (date.getSeconds() !== EXPORTS.CRON_DATE.getSeconds()) {
+        local._objectEachCall(EXPORTS.CRON_SECOND);
+      }
+      EXPORTS.CRON_DATE = date;
+    }
+
+  };
+
+  local._init();
+
+}());
 /*FILE_END*/

File package.json

   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1"
   },
-  "version": "2013.03.20-07.45.14"
+  "version": "2013.03.20-16.00.32"
 }