52 lines
3 KiB
JavaScript
52 lines
3 KiB
JavaScript
// Compiled by ClojureScript 1.9.229 {}
|
|
goog.provide('re_frame.trace');
|
|
goog.require('cljs.core');
|
|
goog.require('re_frame.interop');
|
|
goog.require('re_frame.loggers');
|
|
re_frame.trace.id = cljs.core.atom.call(null,(0));
|
|
re_frame.trace._STAR_current_trace_STAR_ = null;
|
|
re_frame.trace.reset_tracing_BANG_ = (function re_frame$trace$reset_tracing_BANG_(){
|
|
return cljs.core.reset_BANG_.call(null,re_frame.trace.id,(0));
|
|
});
|
|
|
|
/** @define {boolean} */
|
|
goog.define("re_frame.trace.trace_enabled_QMARK_",false);
|
|
/**
|
|
* See https://groups.google.com/d/msg/clojurescript/jk43kmYiMhA/IHglVr_TPdgJ for more details
|
|
*/
|
|
re_frame.trace.is_trace_enabled_QMARK_ = (function re_frame$trace$is_trace_enabled_QMARK_(){
|
|
return re_frame.trace.trace_enabled_QMARK_;
|
|
});
|
|
re_frame.trace.trace_cbs = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
|
|
/**
|
|
* Registers a tracing callback function which will receive a collection of one or more traces.
|
|
* Will replace an existing callback function if it shares the same key.
|
|
*/
|
|
re_frame.trace.register_trace_cb = (function re_frame$trace$register_trace_cb(key,f){
|
|
return cljs.core.swap_BANG_.call(null,re_frame.trace.trace_cbs,cljs.core.assoc,key,f);
|
|
});
|
|
re_frame.trace.remove_trace_cb = (function re_frame$trace$remove_trace_cb(key){
|
|
cljs.core.swap_BANG_.call(null,re_frame.trace.trace_cbs,cljs.core.dissoc,key);
|
|
|
|
return null;
|
|
});
|
|
re_frame.trace.next_id = (function re_frame$trace$next_id(){
|
|
return cljs.core.swap_BANG_.call(null,re_frame.trace.id,cljs.core.inc);
|
|
});
|
|
re_frame.trace.start_trace = (function re_frame$trace$start_trace(p__32733){
|
|
var map__32736 = p__32733;
|
|
var map__32736__$1 = ((((!((map__32736 == null)))?((((map__32736.cljs$lang$protocol_mask$partition0$ & (64))) || (map__32736.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__32736):map__32736);
|
|
var operation = cljs.core.get.call(null,map__32736__$1,new cljs.core.Keyword(null,"operation","operation",-1267664310));
|
|
var op_type = cljs.core.get.call(null,map__32736__$1,new cljs.core.Keyword(null,"op-type","op-type",-1636141668));
|
|
var tags = cljs.core.get.call(null,map__32736__$1,new cljs.core.Keyword(null,"tags","tags",1771418977));
|
|
var child_of = cljs.core.get.call(null,map__32736__$1,new cljs.core.Keyword(null,"child-of","child-of",-903376662));
|
|
return new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"id","id",-1388402092),re_frame.trace.next_id.call(null),new cljs.core.Keyword(null,"operation","operation",-1267664310),operation,new cljs.core.Keyword(null,"op-type","op-type",-1636141668),op_type,new cljs.core.Keyword(null,"tags","tags",1771418977),tags,new cljs.core.Keyword(null,"child-of","child-of",-903376662),(function (){var or__25130__auto__ = child_of;
|
|
if(cljs.core.truth_(or__25130__auto__)){
|
|
return or__25130__auto__;
|
|
} else {
|
|
return new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(re_frame.trace._STAR_current_trace_STAR_);
|
|
}
|
|
})(),new cljs.core.Keyword(null,"start","start",-355208981),re_frame.interop.now.call(null)], null);
|
|
});
|
|
|
|
//# sourceMappingURL=trace.js.map?rel=1603199197609
|