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

Function getCell

src/ui-svelte/functions.svelte.ts:471–508  ·  view source on GitHub ↗
(
  tableId: MaybeGetter<Id>,
  rowId: MaybeGetter<Id>,
  cellId: MaybeGetter<Id>,
  storeOrStoreId?: MaybeGetter<Store | Id | undefined>,
)

Source from the content-addressed store, hash-verified

469 );
470
471export const getCell = (
472 tableId: MaybeGetter<Id>,
473 rowId: MaybeGetter<Id>,
474 cellId: MaybeGetter<Id>,
475 storeOrStoreId?: MaybeGetter<Store | Id | undefined>,
476): {get current(): CellOrUndefined; set current(v: Cell)} => {
477 const getStore = resolveStore(storeOrStoreId);
478 let subscribe = $state<() => void>(noop);
479 if (hasWindow()) {
480 $effect(() => {
481 const store: any = getStore();
482 const tableIdValue = maybeGet(tableId);
483 const rowIdValue = maybeGet(rowId);
484 const cellIdValue = maybeGet(cellId);
485 subscribe = createSubscriber((update) => {
486 const listenerId = store?.addCellListener(
487 tableIdValue,
488 rowIdValue,
489 cellIdValue,
490 update,
491 );
492 return () => store?.delListener?.(listenerId);
493 });
494 });
495 }
496 return new WritableHandle<CellOrUndefined, Cell>(
497 () =>
498 getStore()?.getCell(maybeGet(tableId), maybeGet(rowId), maybeGet(cellId)),
499 (nextCell) =>
500 getStore()?.setCell(
501 maybeGet(tableId),
502 maybeGet(rowId),
503 maybeGet(cellId),
504 nextCell,
505 ),
506 () => subscribe(),
507 );
508};
509
510export const hasValues = (
511 storeOrStoreId?: MaybeGetter<Store | Id | undefined>,

Callers 1

getEditableFunction · 0.90

Calls 8

hasWindowFunction · 0.90
resolveStoreFunction · 0.70
getStoreFunction · 0.70
maybeGetFunction · 0.70
addCellListenerMethod · 0.65
delListenerMethod · 0.65
getCellMethod · 0.65
setCellMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…