Skip to main content

Function: readCommit()

readCommit(read): string

Defined in: src/lib/version/index.ts:23

Read the commit's hash, or UNKNOWN_COMMIT when it wasn't put in place (e.g. the source served or bundled without PaintCanvas's Vite config, where __PAINTCANVAS_COMMIT__ is undefined).

Parameters​

read​

() => unknown

Returns​

string

Example​

readCommit(() => "ac12a0d"); // "ac12a0d"
readCommit(() => { throw new ReferenceError(); }); // "unknown"