goog.provide('reagent.impl.batching'); if((typeof reagent !== 'undefined') && (typeof reagent.impl !== 'undefined') && (typeof reagent.impl.batching !== 'undefined') && (typeof reagent.impl.batching.mount_count !== 'undefined')){ } else { reagent.impl.batching.mount_count = (0); } reagent.impl.batching.next_mount_count = (function reagent$impl$batching$next_mount_count(){ return (reagent.impl.batching.mount_count = (reagent.impl.batching.mount_count + (1))); }); reagent.impl.batching.fake_raf = (function reagent$impl$batching$fake_raf(f){ return setTimeout(f,(16)); }); reagent.impl.batching.next_tick = (((!(reagent.impl.util.is_client)))?reagent.impl.batching.fake_raf:(function (){var w = window; return (function (){var or__5025__auto__ = w.requestAnimationFrame; if(cljs.core.truth_(or__5025__auto__)){ return or__5025__auto__; } else { var or__5025__auto____$1 = w.webkitRequestAnimationFrame; if(cljs.core.truth_(or__5025__auto____$1)){ return or__5025__auto____$1; } else { var or__5025__auto____$2 = w.mozRequestAnimationFrame; if(cljs.core.truth_(or__5025__auto____$2)){ return or__5025__auto____$2; } else { var or__5025__auto____$3 = w.msRequestAnimationFrame; if(cljs.core.truth_(or__5025__auto____$3)){ return or__5025__auto____$3; } else { return reagent.impl.batching.fake_raf; } } } } })().bind(w); })()); reagent.impl.batching.compare_mount_order = (function reagent$impl$batching$compare_mount_order(c1,c2){ return (c1.cljsMountOrder - c2.cljsMountOrder); }); reagent.impl.batching.run_queue = (function reagent$impl$batching$run_queue(a){ a.sort(reagent.impl.batching.compare_mount_order); var n__5616__auto__ = a.length; var i = (0); while(true){ if((i < n__5616__auto__)){ var c_50449 = (a[i]); if(c_50449.cljsIsDirty === true){ c_50449.forceUpdate(); } else { } var G__50450 = (i + (1)); i = G__50450; continue; } else { return null; } break; } }); if((typeof reagent !== 'undefined') && (typeof reagent.impl !== 'undefined') && (typeof reagent.impl.batching !== 'undefined') && (typeof reagent.impl.batching.ratom_flush !== 'undefined')){ } else { reagent.impl.batching.ratom_flush = (function reagent$impl$batching$ratom_flush(){ return null; }); } reagent.impl.batching.run_funs = (function reagent$impl$batching$run_funs(fs){ var n__5616__auto__ = fs.length; var i = (0); while(true){ if((i < n__5616__auto__)){ var fexpr__50339_50451 = (fs[i]); (fexpr__50339_50451.cljs$core$IFn$_invoke$arity$0 ? fexpr__50339_50451.cljs$core$IFn$_invoke$arity$0() : fexpr__50339_50451.call(null)); var G__50452 = (i + (1)); i = G__50452; continue; } else { return null; } break; } }); reagent.impl.batching.enqueue = (function reagent$impl$batching$enqueue(queue,fs,f){ if(cljs.core.truth_(f)){ } else { throw (new Error(["Assert failed: ",["Enqueued function"," must not be nil"].join(''),"\n","f"].join(''))); } fs.push(f); return queue.schedule(); }); /** * @constructor */ reagent.impl.batching.RenderQueue = (function (scheduled_QMARK_){ this.scheduled_QMARK_ = scheduled_QMARK_; }); (reagent.impl.batching.RenderQueue.prototype.flush_after_render = (function (){ var self__ = this; var this$ = this; var temp__5827__auto__ = this$.afterRender; if((temp__5827__auto__ == null)){ return null; } else { var fs = temp__5827__auto__; (this$.afterRender = null); return reagent.impl.batching.run_funs(fs); } })); (reagent.impl.batching.RenderQueue.prototype.queue_render = (function (c){ var self__ = this; var this$ = this; if((this$.componentQueue == null)){ (this$.componentQueue = []); } else { } return reagent.impl.batching.enqueue(this$,this$.componentQueue,c); })); (reagent.impl.batching.RenderQueue.prototype.schedule = (function (){ var self__ = this; var this$ = this; if(self__.scheduled_QMARK_){ return null; } else { (self__.scheduled_QMARK_ = true); var G__50362 = (function (){ return this$.run_queues(); }); return (reagent.impl.batching.next_tick.cljs$core$IFn$_invoke$arity$1 ? reagent.impl.batching.next_tick.cljs$core$IFn$_invoke$arity$1(G__50362) : reagent.impl.batching.next_tick.call(null,G__50362)); } })); (reagent.impl.batching.RenderQueue.prototype.flush_before_flush = (function (){ var self__ = this; var this$ = this; var temp__5827__auto__ = this$.beforeFlush; if((temp__5827__auto__ == null)){ return null; } else { var fs = temp__5827__auto__; (this$.beforeFlush = null); return reagent.impl.batching.run_funs(fs); } })); (reagent.impl.batching.RenderQueue.prototype.flush_queues = (function (){ var self__ = this; var this$ = this; this$.flush_before_flush(); reagent.impl.batching.ratom_flush(); this$.flush_render(); return this$.flush_after_render(); })); (reagent.impl.batching.RenderQueue.prototype.run_queues = (function (){ var self__ = this; var this$ = this; (self__.scheduled_QMARK_ = false); return this$.flush_queues(); })); (reagent.impl.batching.RenderQueue.prototype.add_before_flush = (function (f){ var self__ = this; var this$ = this; if((this$.beforeFlush == null)){ (this$.beforeFlush = []); } else { } return reagent.impl.batching.enqueue(this$,this$.beforeFlush,f); })); (reagent.impl.batching.RenderQueue.prototype.add_after_render = (function (f){ var self__ = this; var this$ = this; if((this$.afterRender == null)){ (this$.afterRender = []); } else { } return reagent.impl.batching.enqueue(this$,this$.afterRender,f); })); (reagent.impl.batching.RenderQueue.prototype.flush_render = (function (){ var self__ = this; var this$ = this; var temp__5827__auto__ = this$.componentQueue; if((temp__5827__auto__ == null)){ return null; } else { var fs = temp__5827__auto__; (this$.componentQueue = null); return reagent.impl.batching.run_queue(fs); } })); (reagent.impl.batching.RenderQueue.getBasis = (function (){ return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(new cljs.core.Symbol(null,"scheduled?","scheduled?",579986609,null),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"tag","tag",-1290361223),new cljs.core.Symbol(null,"boolean","boolean",-278886877,null),new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null))], null); })); (reagent.impl.batching.RenderQueue.cljs$lang$type = true); (reagent.impl.batching.RenderQueue.cljs$lang$ctorStr = "reagent.impl.batching/RenderQueue"); (reagent.impl.batching.RenderQueue.cljs$lang$ctorPrWriter = (function (this__5310__auto__,writer__5311__auto__,opt__5312__auto__){ return cljs.core._write(writer__5311__auto__,"reagent.impl.batching/RenderQueue"); })); /** * Positional factory function for reagent.impl.batching/RenderQueue. */ reagent.impl.batching.__GT_RenderQueue = (function reagent$impl$batching$__GT_RenderQueue(scheduled_QMARK_){ return (new reagent.impl.batching.RenderQueue(scheduled_QMARK_)); }); if((typeof reagent !== 'undefined') && (typeof reagent.impl !== 'undefined') && (typeof reagent.impl.batching !== 'undefined') && (typeof reagent.impl.batching.render_queue !== 'undefined')){ } else { reagent.impl.batching.render_queue = reagent.impl.batching.__GT_RenderQueue(false); } reagent.impl.batching.flush = (function reagent$impl$batching$flush(){ return reagent.impl.batching.render_queue.flush_queues(); }); reagent.impl.batching.flush_after_render = (function reagent$impl$batching$flush_after_render(){ return reagent.impl.batching.render_queue.flush_after_render(); }); reagent.impl.batching.queue_render = (function reagent$impl$batching$queue_render(c){ if(cljs.core.truth_(c.cljsIsDirty)){ return null; } else { (c.cljsIsDirty = true); return reagent.impl.batching.render_queue.queue_render(c); } }); reagent.impl.batching.mark_rendered = (function reagent$impl$batching$mark_rendered(c){ return (c.cljsIsDirty = false); }); reagent.impl.batching.do_before_flush = (function reagent$impl$batching$do_before_flush(f){ return reagent.impl.batching.render_queue.add_before_flush(f); }); reagent.impl.batching.do_after_render = (function reagent$impl$batching$do_after_render(f){ return reagent.impl.batching.render_queue.add_after_render(f); }); reagent.impl.batching.schedule = (function reagent$impl$batching$schedule(){ if(reagent.impl.batching.render_queue.scheduled_QMARK_ === false){ return reagent.impl.batching.render_queue.schedule(); } else { return null; } }); //# sourceMappingURL=reagent.impl.batching.js.map