Added nv.log for convenient inplace logging in dev mode thats omitted when not in dev

master-patched
Bob Monteverde 12 years ago
parent acc85870ca
commit 9d3ded6566

@ -12,7 +12,7 @@ nv.utils = {}; // Utility subsystem
nv.models = {}; //stores all the possible models/components
nv.charts = {}; //stores all the ready to use charts
nv.graphs = []; //stores all the graphs currently on the page
nv.log = {}; //stores some statistics and potential error messages
nv.logs = {}; //stores some statistics and potential error messages
nv.dispatch = d3.dispatch('render_start', 'render_end');
@ -22,19 +22,26 @@ nv.dispatch = d3.dispatch('render_start', 'render_end');
// Public Core NV functions
nv.dispatch.on('render_start', function(e) {
nv.log.startTime = +new Date;
nv.logs.startTime = +new Date;
});
nv.dispatch.on('render_end', function(e) {
nv.log.endTime = +new Date;
nv.log.totalTime = nv.log.endTime - nv.log.startTime;
if (nv.dev && console.log) console.log('total', nv.log.totalTime); //used for development, to keep track of graph generation times
nv.logs.endTime = +new Date;
nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime;
if (nv.dev && console.log) console.log('total', nv.logs.totalTime); //used for development, to keep track of graph generation times
});
// ********************************************
// Public Core NV functions
// Logs all arguments, and returns the last so you can test things in place
nv.log = function() {
if (nv.dev && console.log) console.log.apply(console, arguments);
return arguments[arguments.length - 1];
}
nv.render = function render(step) {
step = step || 1; // number of graphs to generate in each timout loop

8
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

@ -11,7 +11,7 @@ nv.utils = {}; // Utility subsystem
nv.models = {}; //stores all the possible models/components
nv.charts = {}; //stores all the ready to use charts
nv.graphs = []; //stores all the graphs currently on the page
nv.log = {}; //stores some statistics and potential error messages
nv.logs = {}; //stores some statistics and potential error messages
nv.dispatch = d3.dispatch('render_start', 'render_end');
@ -21,19 +21,26 @@ nv.dispatch = d3.dispatch('render_start', 'render_end');
// Public Core NV functions
nv.dispatch.on('render_start', function(e) {
nv.log.startTime = +new Date;
nv.logs.startTime = +new Date;
});
nv.dispatch.on('render_end', function(e) {
nv.log.endTime = +new Date;
nv.log.totalTime = nv.log.endTime - nv.log.startTime;
if (nv.dev && console.log) console.log('total', nv.log.totalTime); //used for development, to keep track of graph generation times
nv.logs.endTime = +new Date;
nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime;
if (nv.dev && console.log) console.log('total', nv.logs.totalTime); //used for development, to keep track of graph generation times
});
// ********************************************
// Public Core NV functions
// Logs all arguments, and returns the last so you can test things in place
nv.log = function() {
if (nv.dev && console.log) console.log.apply(console, arguments);
return arguments[arguments.length - 1];
}
nv.render = function render(step) {
step = step || 1; // number of graphs to generate in each timout loop

Loading…
Cancel
Save