Skip to content

Commit

Permalink
Fix too much output in prodcution mode
Browse files Browse the repository at this point in the history
Close #974
  • Loading branch information
mar10 committed Nov 11, 2019
1 parent cea16eb commit d66e10e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 2.33.1-0 / Unreleased
* TODO: tree.hasFocus() more reliable.
* [Added] `tree.time()`, `tree.timeEnd()` for debugging.
* [Fixed] #974 too much output in prodcution mode.
* [Fixed] #973 when use ext-grid in one tree, other tree not use ext-grid has error on click.

# 2.33.0 / 2019-10-29
Expand Down
8 changes: 4 additions & 4 deletions src/jquery.fancytree.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
// this.debug("_renumberVisibleNodes() ignored.");
return false;
}
window.console.time("_renumberVisibleNodes()");
this.time("_renumberVisibleNodes()");
var i = 0,
prevLength = this.visibleNodeList ? this.visibleNodeList.length : 0,
visibleNodeList = (this.visibleNodeList = []);
Expand All @@ -422,7 +422,7 @@
node._rowIdx = i++;
visibleNodeList.push(node);
});
window.console.timeEnd("_renumberVisibleNodes()");
this.timeEnd("_renumberVisibleNodes()");
if (i !== prevLength) {
this._triggerTreeEvent("updateViewport", null, {
reason: "renumber",
Expand All @@ -446,7 +446,7 @@
// tree.debug("no render", tree._enableUpdate);
return;
}
window.console.time("redrawViewport()");
this.time("redrawViewport()");
this._renumberVisibleNodes(force);
// Adjust vp.start value to assure the current content is inside:
this._fixStart(null, true);
Expand Down Expand Up @@ -500,7 +500,7 @@
trIdx++;
}
this.isVpUpdating = prevPhase;
window.console.timeEnd("redrawViewport()");
this.timeEnd("redrawViewport()");
};

$.ui.fancytree.registerExtension({
Expand Down
20 changes: 20 additions & 0 deletions src/jquery.fancytree.js
Original file line number Diff line number Diff line change
Expand Up @@ -3783,6 +3783,26 @@
setOption: function(optionName, value) {
return this.widget.option(optionName, value);
},
/**
* Call console.time() when in debug mode (verbose >= 4).
*
* @param {string} label
*/
time: function(label) {
if (this.options.debugLevel >= 4) {
window.console.time(this + " - " + label);
}
},
/**
* Call console.timeEnd() when in debug mode (verbose >= 4).
*
* @param {string} label
*/
timeEnd: function(label) {
if (this.options.debugLevel >= 4) {
window.console.timeEnd(this + " - " + label);
}
},
/**
* Return all nodes as nested list of {@link NodeData}.
*
Expand Down

0 comments on commit d66e10e

Please # to comment.