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

Function useSetCallback

src/ui-solid/primitives.ts:305–328  ·  view source on GitHub ↗
(
    storeOrQueries: MaybeAccessor<StoreOrQueries | undefined>,
    settable: string,
    get: (parameter: Parameter, obj: StoreOrQueries) => Thing,
    then: (obj: StoreOrQueries, thing: Thing) => void = getUndefined,
    methodPrefix?: string,
    ...args: (MaybeAccessor<Id> | GetId<Parameter>)[]
  )

Source from the content-addressed store, hash-verified

303
304const useSetCallback =
305 <Parameter, Thing, StoreOrQueries extends Store | Queries>(
306 storeOrQueries: MaybeAccessor<StoreOrQueries | undefined>,
307 settable: string,
308 get: (parameter: Parameter, obj: StoreOrQueries) => Thing,
309 then: (obj: StoreOrQueries, thing: Thing) => void = getUndefined,
310 methodPrefix?: string,
311 ...args: (MaybeAccessor<Id> | GetId<Parameter>)[]
312 ): ParameterizedCallback<Parameter> =>
313 (parameter?: Parameter) =>
314 ifNotUndefined(getThing(storeOrQueries), (obj) =>
315 ifNotUndefined(get(parameter as Parameter, obj), (thing: Thing) =>
316 then(
317 (
318 obj as StoreOrQueries & {
319 [method: string]: (...args: unknown[]) => StoreOrQueries;
320 }
321 )[methodPrefix + settable](
322 ...argsOrGetArgs(args, obj, parameter),
323 thing,
324 ),
325 thing,
326 ),
327 ),
328 );
329
330const useStoreSetCallback = <Parameter, Thing>(
331 storeOrStoreId: MaybeAccessor<StoreOrStoreId | undefined>,

Callers 2

useStoreSetCallbackFunction · 0.70
useQueriesSetCallbackFunction · 0.70

Calls 2

getThingFunction · 0.70
argsOrGetArgsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…