mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
added debug method to util
This commit is contained in:
parent
85400edf48
commit
91ac8802fe
5 changed files with 43 additions and 11 deletions
39
lib/util.js
39
lib/util.js
|
|
@ -6,9 +6,11 @@ var Util, exports;
|
|||
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
|
||||
Util = exports || {};
|
||||
|
||||
var Scope = exports ? global : window;
|
||||
|
||||
/** setting function context
|
||||
* @param {function} pFunction
|
||||
* @param {object} pContext
|
||||
|
|
@ -22,6 +24,16 @@ var Util, exports;
|
|||
return lRet;
|
||||
};
|
||||
|
||||
Util.breakpoint = function(){
|
||||
var lRet = Util.tryCatch(function(){
|
||||
debugger;
|
||||
});
|
||||
|
||||
Util.log(lRet);
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
/**
|
||||
* Функция ищет в имени файла расширение
|
||||
* и если находит возвращает true
|
||||
|
|
@ -82,9 +94,11 @@ var Util, exports;
|
|||
* @param pArg
|
||||
*/
|
||||
Util.log = function(pArg){
|
||||
var lRet = pArg;
|
||||
if(pArg)
|
||||
console.log(pArg);
|
||||
var lRet = pArg,
|
||||
lConsole = Scope.console;
|
||||
|
||||
if(lConsole && pArg)
|
||||
lConsole.log(pArg);
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
|
@ -285,6 +299,21 @@ var Util, exports;
|
|||
return lRet;
|
||||
};
|
||||
|
||||
/**
|
||||
* function execute param function in
|
||||
* try...catch block and log result
|
||||
*
|
||||
* @param pCallBack
|
||||
*/
|
||||
Util.tryCatchDebug = function(pCallBack){
|
||||
var lRet = Util.tryCatch(pCallBack);
|
||||
|
||||
if(lRet)
|
||||
Util.debug();
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
/**
|
||||
* function execute param function in
|
||||
* try...catch block and log result
|
||||
|
|
@ -298,6 +327,7 @@ var Util, exports;
|
|||
|
||||
return Util.log(lRet);
|
||||
};
|
||||
|
||||
/**
|
||||
* function do save exec of function
|
||||
* @param pCallBack
|
||||
|
|
@ -326,4 +356,5 @@ var Util, exports;
|
|||
|
||||
return hours + ":" + minutes + ":" + seconds;
|
||||
};
|
||||
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue