MCPcopy
hub / github.com/algolia/autocomplete / reactive

Function reactive

packages/autocomplete-js/src/createReactiveWrapper.ts:20–36  ·  view source on GitHub ↗
(value: ReactiveValue<TValue>)

Source from the content-addressed store, hash-verified

18
19 return {
20 reactive<TValue>(value: ReactiveValue<TValue>) {
21 const current = value();
22 const reactive: Reactive<TValue> = {
23 _fn: value,
24 _ref: { current },
25 get value() {
26 return this._ref.current;
27 },
28 set value(value) {
29 this._ref.current = value;
30 },
31 };
32
33 reactives.push(reactive);
34
35 return reactive;
36 },
37 runReactives() {
38 reactives.forEach((value) => {
39 value._ref.current = value._fn();

Callers 2

autocompleteFunction · 0.85

Calls 1

valueFunction · 0.85

Tested by

no test coverage detected