123456789101112131415161718192021222324252627282930313233343536373839404142434445464748openCoreletstack=refNonemodulePrivate_for_this_library_only=structletscheduletask=match!stackwith|None->print_endline"You attempted to schedule an [on_mount] task somewhere other than within a \
[with_on_mount_at_end] call, which is not allowed, so the task will not be \
scheduled. This is usually caused by running [Vdom.Node.to_dom] or \
[Vdom.Node.Patch.apply] outside of a widget or hook."|Sometl->stack:=Some(task::tl);;endletwith_on_mount_at_endf=letr=Ref.set_temporarilystack(Some[])~f:(fun()->letr=f()inletstack_has_tasks()=match!stackwith|None->print_endline"BUG! Scheduled tasks should never be empty inside of a \
[with_on_mount_at_end] call.";false|Some[]->false|_->trueinwhilestack_has_tasks()doletto_run=Option.value!stack~default:[]instack:=Some[];List.iter(List.revto_run)~f:(funf->f())done;r)inr;;moduleFor_testing=structletnum_queued_tasks()=match!stackwith|None->0|Somel->List.lengthl;;end