parent
dc577e167d
commit
777685f5e3
@ -1,52 +0,0 @@
|
|||||||
// ===========================================================
|
|
||||||
// DEVBUG INLINE DEBUGGING HELPER - FOR USE WITH DEVBUG SERVER
|
|
||||||
// TODO: REMOVE BEFORE COMMITTING
|
|
||||||
let outs = {}
|
|
||||||
let devbug_url = 'http://localhost:8000/'
|
|
||||||
let project_api_key = 'CHANGEME'
|
|
||||||
const out = (key, what, group="") => {
|
|
||||||
if ( group ){
|
|
||||||
if ( Object.keys(outs).includes(group) ) outs[group][key] = what
|
|
||||||
else outs[group] = {}; outs[group][key] = what
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
outs[key] = what
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const breakpoint = (html = false, name = null) => {
|
|
||||||
var e = new Error();
|
|
||||||
(function() {
|
|
||||||
// Load better json
|
|
||||||
var js_decycle = document.createElement("script");
|
|
||||||
js_decycle.src = devbug_url+"assets/cycle.js";
|
|
||||||
js_decycle.type = 'text/javascript';
|
|
||||||
js_decycle.onload = () => {
|
|
||||||
// Load the script
|
|
||||||
var script = document.createElement("script");
|
|
||||||
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js';
|
|
||||||
script.type = 'text/javascript';
|
|
||||||
script.onload = () => {
|
|
||||||
var $ = window.jQuery;
|
|
||||||
$(() => {
|
|
||||||
var s = e.stack.split('at'); var caller = '';
|
|
||||||
if ( s.length < 3 ) s = e.stack.split('@')
|
|
||||||
if ( s.length > 2 ) caller = s[2].trim()
|
|
||||||
else if ( s.length > 1 ) caller = s[1]
|
|
||||||
else caller = 'Unable to determine stacktrace'
|
|
||||||
var data = new FormData();
|
|
||||||
console.log(JSON.decycle({brief: (name ? name : 'Breakpoint: ')+caller,data: outs}))
|
|
||||||
data.append('data', JSON.stringify(JSON.rmref(JSON.decycle({brief: (name ? name : 'Breakpoint: ')+caller,data: outs}))))
|
|
||||||
$.ajax({
|
|
||||||
url: devbug_url+'api/v1/out/'+project_api_key,
|
|
||||||
data: data, cache: false, contentType: false, processData: false, method: 'POST', type: 'POST',
|
|
||||||
success: (res) => { console.log('DevBug POST Completed'); console.log(res) }
|
|
||||||
})
|
|
||||||
});
|
|
||||||
};
|
|
||||||
document.getElementsByTagName("head")[0].appendChild(script);
|
|
||||||
}
|
|
||||||
document.getElementsByTagName("head")[0].appendChild(js_decycle);
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
window.out = out; window.breakpoint = breakpoint;
|
|
||||||
// ===========================================================
|
|
Loading…
Reference in new issue