A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/WebReflection/alien-signals below:

WebReflection/alien-signals: alien-signals with a Preact signals like API

@webreflection/alien-signals

alien-signals with a Preact signals like API and a class based approach for easy brand check.

import {
  Signal,
  signal, computed,
  effect, untracked,
  // all other alien-signals exports
} from '@webreflection/alien-signals';

const count = signal(0);
const double = computed(() => count * 2);
//               implicit count.valueOf()

console.assert(count instanceof Signal);  // true
console.assert(double instanceof Signal); // true

effect(() => {
  console.log('count', count.peek());
  //                  no subscription

  console.log('double', double.value);
});

count.value++;

A signal created via signal(value, { greedy: true }) will effect any time the same value is set again, as opposite of ignoring the explicit set operation.

Follow this discussion if interest in upstream feedbacks: stackblitz/alien-signals#83


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4