0.3.3 • Published 1 year ago

solid-silmaril v0.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

solid-silmaril

SolidJS bindings for silmaril

NPM JavaScript Style Guide

Install

npm install silmaril solid-silmaril
yarn add silmaril solid-silmaril
pnpm add silmaril solid-silmaril

Usage

fromSignal

import { createSignal, createEffect } from 'solid-js';
import { fromSignal } from 'solid-silmaril';
import { $$, $sync, $store } from 'silmaril';

const [count, setCount] = createSignal(0);

const countStore = fromSignal([count, setCount]);

createEffect(() => {
  console.log('SolidJS Count:', count());
});

$$(() => {
  let counter = $store(countStore);

  $sync(console.log('Silmaril Count:', counter));

  setInterval(() => {
    counter += 1;
  }, 1000);
});

fromStore

import { createEffect } from 'solid-js';
import { fromStore } from 'solid-silmaril';
import { $$, $sync, $store } from 'silmaril';

const countStore = new Store(0);

const [count, setCount] = fromStore(countStore);

$$(() => {
  let counter = $store(countStore);

  $sync(console.log('Silmaril Count:', counter));
});

createEffect(() => {
  console.log('SolidJS Count:', count());
});

setInterval(() => {
  setCount((current) += 1);
}, 1000);

Sponsors

Sponsors

License

MIT © lxsmnsyc

0.3.2

1 year ago

0.3.3

1 year ago

0.2.0

2 years ago