MCPcopy Index your code
hub / github.com/tinyplex/tinybase / save

Function save

src/persisters/common/create.ts:275–294  ·  view source on GitHub ↗
(
    changes?: PersistedChanges<
      Persist,
      IsSynchronizer extends 1 ? false : true
    >,
  )

Source from the content-addressed store, hash-verified

273 const isAutoLoading = () => !isUndefined(autoLoadHandle);
274
275 const save = async (
276 changes?: PersistedChanges<
277 Persist,
278 IsSynchronizer extends 1 ? false : true
279 >,
280 ): Promise<Persister<Persist>> => {
281 /*! istanbul ignore else */
282 if (status != StatusValues.Loading) {
283 setStatus(StatusValues.Saving);
284 saves++;
285 await schedule(async () => {
286 await tryCatch(
287 () => setPersisted(getContent as any, changes),
288 onIgnoredError,
289 );
290 setStatus(StatusValues.Idle);
291 });
292 }
293 return persister;
294 };
295
296 const startAutoSave = async (): Promise<Persister<Persist>> => {
297 stopAutoSave();

Callers 2

saveAfterMutatedFunction · 0.70
startAutoSaveFunction · 0.70

Calls 4

tryCatchFunction · 0.90
setStatusFunction · 0.70
scheduleFunction · 0.70
setPersistedFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…