Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
39
gaia/apps/costcontrol/js/utils/debug.js
Executable file
39
gaia/apps/costcontrol/js/utils/debug.js
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
/* exported debug */
|
||||
'use strict';
|
||||
|
||||
var DEBUGGING = false;
|
||||
|
||||
var debug = (function() {
|
||||
var SEQ_ID = 0;
|
||||
var PROCESS_ID = Date.now();
|
||||
|
||||
var DEBUG_PREFIX = 'CC';
|
||||
|
||||
return function _debug() {
|
||||
if (!DEBUGGING) {
|
||||
return;
|
||||
}
|
||||
|
||||
var currentWindow = window;
|
||||
var parents = [];
|
||||
while (currentWindow !== currentWindow.parent) {
|
||||
parents.push(currentWindow.location.pathname);
|
||||
currentWindow = currentWindow.parent;
|
||||
}
|
||||
parents.push(currentWindow.location.pathname);
|
||||
parents = parents.reverse().join('>') + ':';
|
||||
|
||||
var uId = PROCESS_ID;
|
||||
var message = ['(' + uId + '-' + (SEQ_ID++) + ')', DEBUG_PREFIX, parents];
|
||||
for (var i = 0, len = arguments.length, obj; i < len; i++) {
|
||||
obj = arguments[i];
|
||||
message.push(typeof obj === 'object' ? JSON.stringify(obj) : obj);
|
||||
}
|
||||
if (window.dump) {
|
||||
message.push('\n');
|
||||
window.dump(message.join(' '));
|
||||
} else if (console && console.log) {
|
||||
console.log(message.join(' '));
|
||||
}
|
||||
};
|
||||
}());
|
||||
Loading…
Reference in a new issue