MCPcopy Create free account
hub / github.com/WebReflection/neverland / contextual

Function contextual

index.js:319–336  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

317 };
318 };
319 var contextual = function contextual(fn) {
320 var check = true;
321 var context = null;
322 var augmented = augmentor(function () {
323 return fn.apply(context, arguments);
324 });
325 return function hook() {
326 var result = augmented.apply(context = this, arguments); // perform hasEffect check only once
327
328 if (check) {
329 check = !check; // and copy same Array if any FX was used
330
331 if (hasEffect(augmented)) effects.set(hook, effects.get(augmented));
332 }
333
334 return result;
335 };
336 }; // useReducer
337
338 var updates = umap(new WeakMap());
339

Callers

nothing calls this directly

Calls 1

augmentorFunction · 0.70

Tested by

no test coverage detected