mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-27 22:58:19 +00:00
Experimental debug view
This commit is contained in:
parent
5bce35d90b
commit
898b61a3a0
54
core/modules/debug-view.js
Normal file
54
core/modules/debug-view.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/debug-view.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: global
|
||||||
|
|
||||||
|
debug-view module supports the optional external debug window
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var dm = $tw.utils.domMaker;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Instantiate the debug view
|
||||||
|
*/
|
||||||
|
function DebugView(options) {
|
||||||
|
if($tw.browser) {
|
||||||
|
this.outputFilters = dm("div",{
|
||||||
|
text: "Yes"
|
||||||
|
})
|
||||||
|
this.container = dm("div",{
|
||||||
|
"class": "tc-debug-view",
|
||||||
|
children: [
|
||||||
|
dm("div",{
|
||||||
|
children: [
|
||||||
|
dm("h1",{
|
||||||
|
text: "TiddlyWiki Debug View"
|
||||||
|
}),
|
||||||
|
dm("h2",{
|
||||||
|
text: "Filter Execution"
|
||||||
|
}),
|
||||||
|
this.outputFilters
|
||||||
|
]
|
||||||
|
})
|
||||||
|
]
|
||||||
|
});
|
||||||
|
document.body.appendChild(this.container);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Show a generic network error alert
|
||||||
|
*/
|
||||||
|
DebugView.prototype.displayError = function(msg,err) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.DebugView = DebugView;
|
||||||
|
|
||||||
|
})();
|
@ -330,6 +330,14 @@ exports.compileFilter = function(filterString) {
|
|||||||
}
|
}
|
||||||
})());
|
})());
|
||||||
});
|
});
|
||||||
|
// If we're debugging then wrap each operation function with debug code
|
||||||
|
if(true) {
|
||||||
|
$tw.utils.each(operationFunctions,function(operationFunction,index) {
|
||||||
|
operationFunctions[index] = function(results,source,widget) {
|
||||||
|
return operationFunction(results,source,widget);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
// Return a function that applies the operations to a source iterator of tiddler titles
|
// Return a function that applies the operations to a source iterator of tiddler titles
|
||||||
var fnMeasured = $tw.perf.measure("filter: " + filterString,function filterFunction(source,widget) {
|
var fnMeasured = $tw.perf.measure("filter: " + filterString,function filterFunction(source,widget) {
|
||||||
if(!source) {
|
if(!source) {
|
||||||
|
@ -23,6 +23,8 @@ var PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE = "$:/config/Performance/Instrument
|
|||||||
var widget = require("$:/core/modules/widgets/widget.js");
|
var widget = require("$:/core/modules/widgets/widget.js");
|
||||||
|
|
||||||
exports.startup = function() {
|
exports.startup = function() {
|
||||||
|
// Debug view
|
||||||
|
$tw.debugView = new $tw.DebugView();
|
||||||
// Minimal browser detection
|
// Minimal browser detection
|
||||||
if($tw.browser) {
|
if($tw.browser) {
|
||||||
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
||||||
|
Loading…
Reference in New Issue
Block a user