package ambient-context
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Abstraction over thread-local / continuation-local storage mechanisms for communication with transitive dependencies
Install
dune-project
Dependency
Authors
Maintainers
Sources
ambient-context-0.1.1.tbz
sha256=069907679bb58548d21236de31dd96b9cd94361b764fe0c6b06a5149d14098a8
sha512=519c47993a89fa8b4ab2b5d9dd63b0b80a2a0831fcad2af1ac413e4682435407a9a7c73524706e8ef5d65582ba01097ca20c93e1b8be2f8c556e70dac0a8de00
doc/src/ambient-context.tls/ambient_context_tls.ml.html
Source file ambient_context_tls.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40module TLS = Ambient_context_thread_local.Thread_local module Hmap = Ambient_context_core.Ambient_context_hmap let _internal_key : Hmap.t TLS.t = TLS.create () let[@inline] ( let* ) o f = match o with | None -> None | Some x -> f x module M = struct let name = "Storage_tls" let[@inline] get_map () = TLS.get _internal_key let[@inline] with_map m cb = TLS.with_ _internal_key m @@ fun _map -> cb () let create_key = Hmap.Key.create let get k = let* context = get_map () in Hmap.find k context let with_binding k v cb = let new_context = match get_map () with | None -> Hmap.singleton k v | Some old_context -> Hmap.add k v old_context in with_map new_context @@ fun _context -> cb () let without_binding k cb = match get_map () with | None -> cb () | Some old_context -> let new_context = Hmap.rem k old_context in with_map new_context @@ fun _context -> cb () end let storage () : Ambient_context_core.Types.storage = (module M)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>