59 lines
3.4 KiB
JavaScript
59 lines
3.4 KiB
JavaScript
goog.provide('re_frame.cofx');
|
|
re_frame.cofx.kind = new cljs.core.Keyword(null,"cofx","cofx",2013202907);
|
|
if(cljs.core.truth_((re_frame.registrar.kinds.cljs$core$IFn$_invoke$arity$1 ? re_frame.registrar.kinds.cljs$core$IFn$_invoke$arity$1(re_frame.cofx.kind) : re_frame.registrar.kinds.call(null,re_frame.cofx.kind)))){
|
|
} else {
|
|
throw (new Error("Assert failed: (re-frame.registrar/kinds kind)"));
|
|
}
|
|
re_frame.cofx.reg_cofx = (function re_frame$cofx$reg_cofx(id,handler){
|
|
return re_frame.registrar.register_handler(re_frame.cofx.kind,id,handler);
|
|
});
|
|
re_frame.cofx.inject_cofx = (function re_frame$cofx$inject_cofx(var_args){
|
|
var G__52888 = arguments.length;
|
|
switch (G__52888) {
|
|
case 1:
|
|
return re_frame.cofx.inject_cofx.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
|
|
|
break;
|
|
case 2:
|
|
return re_frame.cofx.inject_cofx.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
|
|
|
break;
|
|
default:
|
|
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
|
|
|
}
|
|
});
|
|
|
|
(re_frame.cofx.inject_cofx.cljs$core$IFn$_invoke$arity$1 = (function (id){
|
|
return re_frame.interceptor.__GT_interceptor.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.Keyword(null,"id","id",-1388402092),new cljs.core.Keyword(null,"coeffects","coeffects",497912985),new cljs.core.Keyword(null,"before","before",-1633692388),(function re_frame$cofx$coeffects_before(context){
|
|
var temp__5802__auto__ = re_frame.registrar.get_handler.cljs$core$IFn$_invoke$arity$2(re_frame.cofx.kind,id);
|
|
if(cljs.core.truth_(temp__5802__auto__)){
|
|
var handler = temp__5802__auto__;
|
|
return cljs.core.update.cljs$core$IFn$_invoke$arity$3(context,new cljs.core.Keyword(null,"coeffects","coeffects",497912985),handler);
|
|
} else {
|
|
return re_frame.loggers.console.cljs$core$IFn$_invoke$arity$variadic(new cljs.core.Keyword(null,"error","error",-978969032),cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["No cofx handler registered for",id], 0));
|
|
}
|
|
})], 0));
|
|
}));
|
|
|
|
(re_frame.cofx.inject_cofx.cljs$core$IFn$_invoke$arity$2 = (function (id,value){
|
|
return re_frame.interceptor.__GT_interceptor.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.Keyword(null,"id","id",-1388402092),new cljs.core.Keyword(null,"coeffects","coeffects",497912985),new cljs.core.Keyword(null,"before","before",-1633692388),(function re_frame$cofx$coeffects_before(context){
|
|
var temp__5802__auto__ = re_frame.registrar.get_handler.cljs$core$IFn$_invoke$arity$2(re_frame.cofx.kind,id);
|
|
if(cljs.core.truth_(temp__5802__auto__)){
|
|
var handler = temp__5802__auto__;
|
|
return cljs.core.update.cljs$core$IFn$_invoke$arity$4(context,new cljs.core.Keyword(null,"coeffects","coeffects",497912985),handler,value);
|
|
} else {
|
|
return re_frame.loggers.console.cljs$core$IFn$_invoke$arity$variadic(new cljs.core.Keyword(null,"error","error",-978969032),cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["No cofx handler registered for",id], 0));
|
|
}
|
|
})], 0));
|
|
}));
|
|
|
|
(re_frame.cofx.inject_cofx.cljs$lang$maxFixedArity = 2);
|
|
|
|
re_frame.cofx.reg_cofx(new cljs.core.Keyword(null,"db","db",993250759),(function re_frame$cofx$db_coeffects_handler(coeffects){
|
|
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(coeffects,new cljs.core.Keyword(null,"db","db",993250759),cljs.core.deref(re_frame.db.app_db));
|
|
}));
|
|
re_frame.cofx.inject_db = re_frame.cofx.inject_cofx.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"db","db",993250759));
|
|
|
|
//# sourceMappingURL=re_frame.cofx.js.map
|