import { type WhenDone } from "https://deno.land/x/cav@0.0.8/browser/mod.ts";
A Packer's unpack()
function receives the raw packed JSON value as its
first argument and this registration function as the second. Functions
registered with WhenDone will be run last-in-first-out (stack order) when the
raw JSON has been processed into the final object instances. WhenDone
functions are needed whenever the packed data is more complex than simple
JSON values, for example when referential equality needs to be maintained or
when the pack function returns anything that needs to be re-packed by some
other packer. Referenced objects may not be fully initialized when the
registered function is called, but its instance will be instantiated so that
references can be fixed.
definition: (fn: (packed: O) => void) => void