monitor.js.util.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trace-spring-boot-starter Show documentation
Show all versions of trace-spring-boot-starter Show documentation
Used to invoke the chain visualization.
The newest version!
// 有孩子结点
function hasChild(obj) {
return !isEmpty(obj) && obj.length >= 1;
}
// 不为空
function isEmpty(obj) {
return obj === null || obj === 'undefined' || obj === '';
}
function getRandomId() {
return Number(Math.random().toString().substr(3, 10) + Date.now()).toString(36);
}
// 异步get
function asyncHttpGet(url, callback) {
return asyncHttp("get", url, callback);
}
// 同步get
function syncHttpGet(url) {
return syncHttp("get", url);
}
function syncHttp(type, url) {
let data;
$.ajax({
type: type,
url: url,
async: false,
success: function (rtn) {
data = rtn;
}
});
return data;
}
function asyncHttp(type, url, callback) {
$.ajax({
type: type,
url: url,
async: true,
success: function (rtn) {
if (typeof callback === "function") {
callback(rtn);
}
}
});
}